From: "Abdul-wahid Paterson" <[EMAIL PROTECTED]>

>> What do you mean you don't know what button was pressed? You have
'test_x'
>> and 'test_y' so you know the "test" button was pressed. If you give the
>> other buttons a different name, you'll have different _x and _y variable
>> names, so you can still tell which one was pressed.

> Yes, I should have specified more accurately. I have quite a few of
> these buttons on one page (approx 30) and really wanted to have the same
> name="" for each one and only the value change. The reasoning for that
> is most parts of the page are generated from cached content due to heavy
> processing requirements on making the whole page.
>
> It is therefore quite difficult for me to change it to something like a
> series of name="test1" and name="test2" for all the buttons as the form
> being POST'd to would have a hard job trying to work out which names
> were valid for the POSTing form.

Diffucult? bah...

<form method="GET" action="page.php">
<input type="image" name="image[button1]" src="pic.gif">
<input type="image" name="image[button2]" src="pic.gif">
<input type="image" name="image[button3]" src="pic.gif">
</form>

Then, on page.php, to figure out what button was chosen, you simply use:

$button = each($_GET['image']);

Now, $button[0] or $button['key'] (whichever you want to use) will have one
of the values of "button1", "button2", or "button3" from your form.

Adapt to your needs.

---John Holmes...


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to