Re: get the clicked submit image
| From: | Mike Frazer | Date: | Wed, 30 Jan 2002 19:18:47 +0000 |
| Subject: | Re: get the clicked submit image | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-82763@lists.php.net to get a copy of this message | ||
I *think* you can get the values with $HTTP_GET_VARS['image1.x'] (and the
same for image1.y). If your method is set to POST, use the $HTTP_POST_VARS
array instead.
Obviously to tell which one the user clicked you can use
if (isset($HTTP_GET_VARS['image1.x])) {
... code here ...
}
If the value has been set, that image was clicked. The x and y values
correspond to the precise pixel that was clicked which allows these to be
used as pseudo-imagemaps which you can code for.
Mike Frazer
"Ergin Aytac" <ergin@tutorialtimes.com> wrote in message
news:20020130131949.37785.qmail@pb1.pair.com...
> I have a form-page with several image-submit buttons. how can I know which
> image is clicked? It's not allowed to use java-script or any client-side
> "make the life easy"-scripts.
>
> <form name="form1" method="get" action="test.php">
> <input type="image" border="0" name="image1"
> src="goa.gif">
> <input type="image" border="0" name="image2"
> src="gob.gif">
> </form>
>
> I get two vars per image with the clicked point values on the image like
> image1.x, image1.y and so on. How can I get the values of these variables?
I
> tried $image1.x, ${"image1.x"}, $image1["x"], but they didnt work. I could
> not find out the correct syntax.
>
> if I get the value of these vars or use the isset function, I can get out
> which image is clicked because the "non-clicked" image has no values for
the
> clicked-point on itself.
>
> the vars are available in $QUERY_STRING so I could parse it, but I think
> there is a simple way to get these vars.
>
> thanx (also for any links to manuals).
>
> Ergin Aytac
>
>