title: Editing MySQL recode using a HTML form
body: <p>Im working on a small PHP project for learning purpose. i want to retrieve saved data from a MySQL data base and let the user edit it using a HTML form. im able to retrieve the data and  display in the text boxes. problem is when the form is submitted data is not updating. here is the code i got so far. file is made to update it self. if anyone can tell me where did i go wrong it will be most appreciated. thank you.</p>
  
  <pre><code>&lt;?php
  
  include ("header.php");
  include ("../db.php");
  
  $catname = $_POST['catname'];
  $catdisc = $_POST['catdisc'];
  
  $id = $_GET['id'];
          if (isset($id))
          {
  $query = "SELECT * FROM categories WHERE catid='$id'";
  $result= mysql_query($query) or die ('Mysql Error');
  
  }
  
  while($row = mysql_fetch_array($result)){
  $cname = $row['catname'];
  $cdisc = $row['catdisc'];
  }
  
  $result= "UPDATE categories SET catname='$catname', catdisc='$catdisc' WHERE catid='$id'"
  or die ('Error Updating'); 
  
  ?&gt;
  
  &lt;h1&gt;Edit Categories&lt;/h1&gt;
  
  &lt;form method="post" action="edit_cat.php?id=&lt;?php echo $id;?&gt;"&gt;
  Category Name: &lt;input type="text" name="catname" value="&lt;?php echo $cname;?&gt;"&gt;&lt;br/&gt;
  Category Discription: &lt;TEXTAREA NAME="catdisc"ROWS="3" COLS="25"&gt;&lt;?php echo $cdisc;?&gt;&lt;/TEXTAREA&gt;&lt;br/&gt;&lt;br/&gt;
  &lt;input type="submit" value="Update Category"/&gt;
  &lt;/form&gt;
  
  &lt;?php
  include ("footer.php");
  ?&gt;
  </code></pre>