title: Update table based on user action
body: <p>Im tryng to update a table based on a user action please help, When i submit the query nothng happens        if user selects edit it should update the table what Am I doing wrong?  </p>
  
  <pre><code>if ($action == "edit"){
  
  
  $edit = $_POST['edit'];
  $first_name = $_POST['first_name'];
  $last_name = $_POST['last_name'];
  $email = $_POST['email'];
  
  
  $sql=mysql_query("select * from user where id='$id'");
  
     while ($row=mysql_fetch_array($sql)) 
   {                                                                                                                                                                                                                                                     
  $id = $row['id'];
  $first_name = $row['first_name'];
  $last_name = $row['last_name'];
  $email = $row['email'];
  
  $result=mysql_query("UPDATE user SET first_name='$first_name',last_name='$last_name',email='$email' WHERE id='$id'");
  
  
  echo("&lt;form name='edit' method='post' action='?action=edit'&gt;");
  echo("&lt;input type='hidden' name='?action=edit'&gt;");
  echo("&lt;table class=main cellspacing=0 cellpadding=5 &gt;");
  echo("&lt;tr&gt;&lt;td&gt;Name: &lt;/td&gt;&lt;td align='right'&gt;&lt;input type='text' name='first_name' value='$first_name'&gt;&lt;/td&gt;&lt;/tr&gt;");
  echo("&lt;tr&gt;&lt;td&gt;Surname: &lt;/td&gt;&lt;td align='right'&gt;&lt;input type='text'  name='last_name' value='$last_name'&gt;&lt;/td&gt;&lt;/tr&gt;");
  echo("&lt;tr&gt;&lt;td&gt;Email: &lt;/td&gt;&lt;td align='right'&gt;&lt;input type='text' name='email' value='$email'&gt;&lt;/td&gt;&lt;/tr&gt;");
  echo("&lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;div align='right'&gt;&lt;input type='submit'&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;");
  echo("&lt;/table&gt;");
       }    
           }
  </code></pre>