Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5
This is the forum to discuss the Wrox book Beginning PHP4 by Wankyu Choi, Allan Kent, Chris Lea, Ganesh Prasad, Chris Ullman; ISBN: 9780764543647
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 18th, 2003, 01:14 AM
Authorized User
 
Join Date: Oct 2003
Location: hyderabad, andhra, India.
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to phpsharma Send a message via Yahoo to phpsharma
Default How can we submit a form without a submit butto

with out using submit <input type="submit">
how to in php?

www.sharma.5u.com

God Knows better than US
__________________
God Knows better than US
Reply With Quote
  #2 (permalink)  
Old October 18th, 2003, 01:36 AM
richard.york's Avatar
Wrox Author
Points: 5,506, Level: 31
Points: 5,506, Level: 31 Points: 5,506, Level: 31 Points: 5,506, Level: 31
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Camby, IN, USA.
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

phpsharma,
If you don't want to use a submit button then you would use javascript or an alternate syntax for the input button. PHP wouldn't have anything to do with that side of it.

<input type='submit' value='Click Here' name='var' />
<input type='image' src='images/submit.jpg' value='Submit' alt='Submit' name='var' />

What you will get, because it's an image,

var.x = (x coordinates where user clicked)
var.y = (y coordinates where user clicked)

I did some testing on this and I can't seem to retrieve the values in PHP.

I used the following:

if (isset($_POST["var.x"])) echo $_POST["var.x"];
if (isset($_POST["var.y"])) echo $_POST["var.y"];

or even with the $_GET method if the form is set to submit via get, the query string shows up but I am not able to get the values to output from a script.

if (isset($_GET["var.x"])) echo $_GET["var.x"];
if (isset($_GET["var.y"])) echo $_GET["var.y"];

However despite this I was able to access other data set from other input elements. I'll have to do some researching on this to see how you access the data passed by the button itself.

??

If you don't want to use an image but want to use some other method, like fire form submission when a user selects something from a drop down list you would do that with JavaScript and would be a question better suited for that forum.

: )
Rich


:::::::::::::::::::::::::::::::::
Smiling Souls
http://www.smilingsouls.net
:::::::::::::::::::::::::::::::::
Reply With Quote
  #3 (permalink)  
Old October 18th, 2003, 01:44 AM
richard.york's Avatar
Wrox Author
Points: 5,506, Level: 31
Points: 5,506, Level: 31 Points: 5,506, Level: 31 Points: 5,506, Level: 31
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Camby, IN, USA.
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

Ok problem solved,

In PHP if you use an image input type... like so...
<input type='image' src='images/submit.jpg' value='Submit' alt='Submit' name='var' />

And submitted via the post method..
The coordinates are accessible as follows:

if (isset($_POST["var_x"])) echo $_POST["var_x"];
if (isset($_POST["var_y"])) echo $_POST["var_y"];

Where the 'var' part of the indice is the name of the field, the underscore replaces the dot and 'x', 'y' are the coordinates.

So var.x becomes var_x in PHP.

: )
Rich

:::::::::::::::::::::::::::::::::
Smiling Souls
http://www.smilingsouls.net
:::::::::::::::::::::::::::::::::
Reply With Quote
  #4 (permalink)  
Old October 18th, 2003, 08:29 AM
Authorized User
 
Join Date: Oct 2003
Location: hyderabad, andhra, India.
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to phpsharma Send a message via Yahoo to phpsharma
Default

thank you quesadilla5


God Knows better than US
Reply With Quote
  #5 (permalink)  
Old October 20th, 2003, 08:50 AM
Friend of Wrox
Points: 2,570, Level: 21
Points: 2,570, Level: 21 Points: 2,570, Level: 21 Points: 2,570, Level: 21
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: San Diego, CA, USA
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The javascript required to submit a form is simple:

formname.submit();

where formname is the value of the name attribute of your form tag.

Play with this toy script to get the idea.

<form name="myform" method="get" action="<?php echo $_SERVER['PHP_SELF'];?>">
  <input type="text" name="username" />
</form>

<a href="javascript:myform.submit();">Submit this form!</a>

<pre>
<?php
if (isset($_GET)) print_r($_GET);
?>
</pre>


Take care,

Nik
http://www.bigaction.org/
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Form submit into Excel raversunite Infopath 0 August 1st, 2007 05:43 AM
How to submit the different data on single submit pushpa Classic ASP Databases 1 January 24th, 2007 07:10 PM
One form.. two submit buttons ashraf_gawdat HTML Code Clinic 1 July 28th, 2006 06:56 PM
Form Submit Nitin_sharma Javascript 1 December 2nd, 2004 08:51 AM



All times are GMT -4. The time now is 05:15 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.