troubleshooting Question

using 2 submit buttoms on a form and passing to php

Avatar of markmchugh
markmchugh asked on
20 Comments1 Solution327 ViewsLast Modified:
I have a table on a form, which i populate using the following

@mysql_select_db("phardddsd") or die( "Unable to select database");
$query = "Select * from tempcart where userid = $_SESSION[userid]";
$result1 = mysql_query($query);
if (mysql_num_rows($result1) > 0)

echo ("<table width=\"100%\"  border=\"0\">
  <tr bgcolor=\"#999999\">
    <td width=\"26%\" bgcolor=\"#99CCFF\"><div align=\"center\">Date Job Added </div></td>
    <td width=\"34%\" bgcolor=\"#99CCFF\"><div align=\"center\">Job Title </div></td>
    <td width=\"33%\" bgcolor=\"#99CCFF\"><div align=\"center\">Location</div></td>
    <td width=\"7%\" bgcolor=\"#99CCFF\">Delete</td>

while ($myrow = mysql_fetch_array($result1))

$query2 = "Select * from jobs where id = $myrow[2]";
$result2 = mysql_query($query2);
$myrow1 = mysql_fetch_array($result2);
$tmpdate =       strftime ("%d/%m/%Y", strtotime($myrow[11]));
echo ("  <tr bgcolor=\"#E9E9E9\">
    <td>$tmpdate </td>
      <input type=\"checkbox\" name=\"checkbox$myrow[0]\" value=\"$myrow[0]\">


and at the  end of the form, i have 2 submit buttons, , here's the code

<td><input name="submit" type="submit" class="submit" value="Delete" /></td>
<td ><input name="submit3" type="submit" class="submit" value="Flag to supervisor >>   " /></td>

when a user hite either button, i want a php script that can check which button has been selected, and update the database accordingly

here's my php for this

@mysql_select_db("pharmacyone") or die( "Unable to select database");

while (list($name,$value) = each($HTTP_POST_VARS))



      if (isset($submit)){
      $query = "delete from jobs where id = $value";
      $query = "INSERT INTO supervisorlogs VALUES ('','$_SESSION['userid']','$value')";

//      $$name = $value;


any idea what  can do to solve this quickly?
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 20 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 20 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros