Example of a two button form

Name :



Code for the form

<form  method="post" action= "action2.php">

Name : <input type="text" name="name" size="30" value="" maxlength="60"/><br /><br />

<input type="submit" value="b1" name="b1" />

<input type="submit" value="b2" name="b2" /><br /><br />

</form>

The PHP script "action2.php"

<?php
if ($b1)
header('location:1.php');
elseif ($b2)
header('location:2.php');
?>

The PHP script "1.php"

<?php
echo "<h1>Congratulations!  You just hit button 1</h1>
<h2>You are running the script 1.php</h2>";
?>

The PHP script "2.php"

<?php
echo "<h1>Congratulations!  You just hit button 2</h1>
<h2>You are running the script 2.php</h2>";
?>