title: Fields inserting blank data into database
body: <p>I've checked my code compared with code elsewhere on my site and I can't see any inconsistencies, but for some reason the records are entering my database with blank data, here is my code.</p>
  
  <pre><code>&lt;?php
  
  include '../includes/connect.php';
  include '../header.php';
  
  echo '&lt;h2&gt;Create a Sub category&lt;/h2&gt;';
  if($_SESSION['signed_in'] == false | $_SESSION['user_level'] != 1 )
  {
  //the user is not an admin
  echo 'Sorry, you do not have sufficient rights to access this page.';
  }
  else
  {
  //the user has admin rights
  if($_SERVER['REQUEST_METHOD'] != 'POST')
  {
      //the form hasn't been posted yet, display it
      echo '&lt;form method="post" action=""&gt;
          Category name: ';
          $sql = "SELECT cat_id, cat_name, cat_description FROM categories";
          $result = mysql_query($sql);
      echo '&lt;select name="topic_cat"&gt;';
                  while($row = mysql_fetch_assoc($result))
                  {
                      echo '&lt;option value="' . $row['cat_id'] . '"&gt;' . $row['cat_name'] . '&lt;/option&gt;';
                  }
              echo '&lt;/select&gt;&lt;br /&gt;';
  
  
      echo 'Sub category name: &lt;input type="text" name="sub_cat_name" /&gt;&lt;br /&gt;
          Sub category description:&lt;br /&gt; &lt;textarea name="sub_desc" /&gt;&lt;/textarea&gt;&lt;br /&gt;&lt;br /&gt;
          &lt;input type="submit" value="Add Sub Category" /&gt;
       &lt;/form&gt;';
  }
  else
  {
  
      //the form has been posted, so save it
      $sql = "INSERT INTO subcategories(c_id, sub_cat_name, sub_desc)
         VALUES('" . $_POST['categories.cat_id'] . "', '" . $_POST['sub_cat_name'] . "', '" . $_POST['sub_desc'] . "')";
      $result = mysql_query($sql) or die (mysql_error());
              echo 'The sub category &lt;b&gt;' . $row['sub_cat_name'] . '&lt;/b&gt; has been added under the main category &lt;b&gt;' . $row['cat_name'] . '&lt;/b&gt;';
      if(!$result)
      {
          //something went wrong, display the error
          echo 'Error' . mysql_error();
  
      }
  }
  }
  ; ?&gt;
  </code></pre>
  
  <p>My <strong>categories</strong> table is structured like so..</p>
  
  <ul>
  <li>cat_id </li>
  <li>cat_desc</li>
  </ul>
  
  <p>My <strong>subcategories</strong> table is structured like so..</p>
  
  <ul>
  <li>id(AI) </li>
  <li>c_id </li>
  <li>sub_cat_name </li>
  <li>sub_desc</li>
  </ul>
  
  <p>If I haven't provided enough information please let me know.</p>