Hi
I have a web page that contain 2 different controls(Button,DropDownBox).
the 2 controls can submit the form.
I want to know if there is a way to know whiche control have sumitted the form.
i want to konw this because i want to redirect that page to one of other 2 pages
depend on the control that have submitted it.
Thanks
2 controls submit one form
Moderator: General Moderators
-
alexmaster_2004
- Forum Commoner
- Posts: 35
- Joined: Wed Sep 14, 2005 8:44 am
- shiznatix
- DevNet Master
- Posts: 2745
- Joined: Tue Dec 28, 2004 5:57 pm
- Location: Tallinn, Estonia
- Contact:
well since you are obviously using javascript you can have a hidden field then when its submitted but the dropdown box change the value of that dropdown box to "dropdown" or somthing, then for the other (lets say submit button) just have the value changed to "submit_btn" or just keep the default. then on the next page check the value of the hidden field and go from there
-
alexmaster_2004
- Forum Commoner
- Posts: 35
- Joined: Wed Sep 14, 2005 8:44 am
Code: Select all
<?
if(isset($_POST['bobby']))
echo "submit button clicked";
else if(isset($_POST['bob']))
echo "select changed";
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
<form method="post" name="MyForm">
<select name="bob" onChange="document.MyForm.submit()">
<option value=""></option>
<option value="1">1</option>
<option value="2">2</option>
</select>
<input type="submit" name="bobby">
</form>
</body>
</html>