Form with Multiple Submit Buttons
From ChadsCode.com
Ever wanted to give users multiple form submission options. Here's how! Demo
This will require two files:
4.php ~ This file contains the actual form
<html>
<body>
<form name="input" action="4-1.php" method="post">
Username:
<input type="text" name="user" />
<input type="submit" name="save" value="save" onclick="this.value('save')";>
<input type="submit" name="cancel" value="cancel" onclick="this.value('cancel');">
</form>
</body>
</html>
4-1.php ~ This php processes the values from the form and displays them
<?
$user = $_POST['user'];
$save = $_POST['save'];
$cancel = $_POST['cancel'];
if(!strcmp($save, "save")) {
echo $user." pressed the ".$save." button";
}
if(!strcmp($cancel, "cancel")) {
echo $user." pressed the ".$cancel." button";
}
?>
