There are several forums that discuss using two submit buttons. I am using one of the codes offered. The problem gets interesting when the buttons are selected.
Here's the form page code:
<html>
<form action=select.php method=post>
<select name=id align=center><br>
<?php
$db = mysql_connect("CONNECT", "STUFF","HERE");
mysql_select_db("TABLE",$db);
$result = mysql_query("SELECT * FROM employees ORDER BY id DESC",$db);
while ($myrow = mysql_fetch_assoc($result))
{
$Fullname = $myrow["Fullname"];
$id = $myrow["id"];
$position = $myrow["position"];
$address = $myrow["address"];
$date = $myrow["date"];
$last = $myrow["last"];
$first = $myrow["first"];
$photo = $myrow["photo"];
echo "<option value=$id >$Fullname<br>";
}
echo "</select>";
echo "<p>";
echo "<center>";
echo "<input type=submit name=edit value='Edit Obit' />";
echo " ";
echo " ";
echo "<input type=submit name=view value='View Obit' />";
echo " ";
echo " ";
echo "<input type=submit name=send value='Send Obit' />";
echo "</form>";
?>
And Here id the php for select.php:
<?php
$entry=stripslashes(htmlentities($POST['entry']));
if ($entry){
if ($POST['edit']!=""){
echo "This '$entry' would be edited.";
}
else if ($POST['view']!=""){
echo "This '$entry' would be viewed.";
}
else if ($POST['send']!=""){
echo "This '$entry' would be sent.";
}
}
?>
Here's the Question: How can you send a user to the page that he/she has selected. How can you send the person to the edit page if they select the edit submit button. I would guess that the code would go where each of the lines arethat read:
echo "This '$entry' would be edited.";
Any help in solving this problem would surely answer a bunch of questions for people working with two or three submit buttons.
I leave it to the experts.
Thanks,
cmpennington