RE: [PHP] Differentiating multiple "INPUT type=image" in a single form.
| From: | Matt Williams | Date: | Mon, 30 Oct 2000 16:04:53 +0000 |
| Subject: | RE: [PHP] Differentiating multiple "INPUT type=image" in a single form. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-22698@lists.php.net to get a copy of this message | ||
Hi Ken
> In my HTML page, there's a form:
>
> <FORM method="post" action="processform.php">
>
> <!-- Other form fields go here...-->
> <!-- ... -->
>
> <!-- Image buttons for different actions to be performed inside
> processform.php -->
> <INPUT type="image" name="button" value="Change"
> ALT="Change"
> SRC="change.gif">
> <INPUT type="image" name="button" value="Confirm"
> ALT="Confirm"
> SRC="confirm.gif">
>
> </FORM>
After searching the lists this morning on this subject.
What I came up with was that image buttons are referenced by their
co-ordinates.
The easiest way is to give each image a different name ie. change, confirm
etc.....
then $change_x and $change_y would be set if change button has been pressed
etc...
The only problem I found is that if the user presses enter to submit the
form. You cannot then reference the images by the means above.
To get around this you could create a different form for each button and
insert a hidden field as well.
Then just check for either the co-ordinates or hidden field
M@