title: Single PHP form with 2 (edit and delete) buttons
body: <p>I am trying to set up a form with 2 buttons - "DELETE" which runs on the page delete.php and "EDIT" which runs on edit.php.</p>
  
  <p>So I need a different action depending on which button they have clicked...</p>
  
  <p>Here's my code.</p>
  
  <pre><code>$con = mysql_connect("localhost","user","password");
  if (!$con)
    {
    die('Could not connect: ' . mysql_error());
    }
  
  mysql_select_db("test", $con);
  
  $result = mysql_query("SELECT * FROM myTable");
  
  // Need to change the action depending on what button is clicked
  echo "&lt;form name='wer' id='wer' action='delete.php' method='post' &gt;";
  echo "&lt;table border='1'&gt;";
  
  while($row = mysql_fetch_array($result))
    {
      echo "&lt;tr&gt;";
      echo "&lt;td&gt;" . $row['id'] . "&lt;/td&gt;";
      echo "&lt;td&gt;" . $row['page_title'] . "&lt;/td&gt;";
      echo "&lt;td&gt;&lt;input type='radio' name='test1' value='" . $row['id'] . "' /&gt;&lt;/td&gt;";
      echo "&lt;/tr&gt;";
    }
  
  echo "&lt;tr&gt;";
  echo "&lt;td&gt;&amp;nbsp;&lt;/td&gt;";
  echo "&lt;td&gt;&amp;nbsp;&lt;/td&gt;";
  echo "&lt;td&gt;&lt;input type='submit' name='delete' value='Delete' /&gt; &lt;input type='submit' name='edit' value='Edit' /&gt;&lt;/td&gt;";
  echo "&lt;/tr&gt;";
  echo "&lt;/table&gt;";
  echo "&lt;/form&gt;";
  
  mysql_close($con);
  </code></pre>