|
Posted by Hilarion on 07/19/05 19:24
> That wont work since any button that is on the form is automatically
> triggered by the form action that is meant for the submit button.
What? Are you talking about submit action performed by clicking
on "submit" button, or using "submit()" method of form?
If you have HTML form with multiple "submit" buttons, then
the all data control (textbox, checkbox, select, radio) values
are submited to the form action URL (using specified method), but
the value list also contains value of the one (and only one)
clicked "submit" button with this button name as value name.
So if you have form like this:
<form action="action.php" method="get">
<input type="text" name="txt1" value="val1" />
<input type="submit" name="sbmt1" value="sub val1" />
<input type="submit" name="sbmt2" value="sub val2" />
<input type="submit" value="sub unnamed" />
</form>
then after clicking "sub val1" you get:
$_GET['txt1'] == 'val1'
$_GET['sbmt1'] == 'sub val1'
after clicking "sub val2" you get:
$_GET['txt1'] == 'val1'
$_GET['sbmt2'] == 'sub val2'
after clicking "sub unnamed" you get:
$_GET['txt1'] == 'val1'
Yes, it can be browser-specific, but most browsers do it like
that.
The solution which Arjen suggested should work.
Hilarion
Navigation:
[Reply to this message]
|