title: Php Mysql Update
body: <p>I have some code that I am trying to make into a news feed for my front page. So far I cant get the Update to work. Ps feel free to clean up code and make for practical as this is version 1 I haven't cleaned code up. Thanks Joshua</p>
  
  <p>Update Part</p>
  
  <pre><code>    if(isset($_POST['edit']))
      {
      $checkbox = $_POST['checkbox'];
  
      for($i=0;$i&lt;count($_POST['checkbox']);$i++){
  
      $edit_id = $checkbox[$i];
  
          echo "&lt;textarea name='editsavetext' id='editsavetext' rows='4' cols='50'&gt;$edit_id&lt;/textarea&gt;";
      }};
  
      if(isset($_POST['editsave'])){
  
      echo $editsavetext;
  
      $editsavetext = $_POST['editsavetext'];
  
      $sql='UPDATE $tbl_name SET home_show = $editsavetext WHERE home_show = $edit_id';
  
      $result = mysql_query($sql);
  
      if($result){
  echo "&lt;meta http-equiv='refresh' content='0; url=http://****' /&gt;";}};
  </code></pre>
  
  <p>For Rich Bradshaw</p>
  
  <p>Well at the moment the code doesnt work because i need the system to remember what checkbox was ticks and what is being edited using $edit_id because it doesnt remember the results when being saved so it doesnt effect anything as such. </p>
  
  <pre><code>if(isset($_POST['edit']))
  {
  $checkbox = $_POST['checkbox'];
  
  for($i=0;$i&lt;count($_POST['checkbox']);$i++){
  
  $edit_id = $checkbox[$i];
  
      echo "&lt;textarea name='editsavetext' id='editsavetext' rows='4' cols='50'&gt;$edit_id&lt;/textarea&gt;";
  }};
  
  if(isset($_POST['editsave'])){
  
  echo $editsavetext;
  
  $editsavetext = $_POST['editsavetext'];
  
  $sql="UPDATE `$tbl_name` SET home_show = '$editsavetext' WHERE home_show=':edit_id'";
  
  $result = mysql_query($sql);
  
  if($result){echo "&lt;meta http-equiv='refresh' content='0; url=http://****' /&gt;";}};
  </code></pre>