title: insert selected option into table
body: <p>I have this code and I'm trying to put the selected state in a subcat table.
  So far it returns an empty value. I'm not sure if this is clear or not, but all I want is: select a state from the select option and submit it. I want to get the selected state name into my table subcat.</p>
  
  <pre><code>enter &lt;?php
  include("connect.php");
  $state = $row['states']; //Select name
  if (isset($_POST[submit])){
  $query = "INSERT INTO subcat (sub_name) VALUES ('$state')";
  mysql_query($query) or die(mysql_error());
  }
  ?&gt;
  &lt;form action="" method="post" name="form"&gt;
  &lt;?php
  $sql = mysql_query("SELECT * FROM   state");
  echo "&lt;select name='states'&gt;
  &lt;option value=''&gt;Select a state&lt;/option&gt;";
  while ($row = mysql_fetch_assoc($sql)) {
  echo "&lt;option value='$row[id]'&gt;$row[name]&lt;/option&gt;";
  }
  echo "&lt;/select&gt;";
  ?&gt;
  &lt;input type="submit" name="submit" value="Continue" /&gt;
  &lt;/form&gt; here
  </code></pre>
  
  <p>Thanks</p>