title: insert values from a drop down list to database table
body: <p>I am new to PHP. When i am  trying to insert the value from drop down list to database table showing some errors</p>
  
  <p>the code</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;OPTION&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;form action="option.php" method="get"&gt;
  Name :&lt;select name="name"&gt;
  &lt;option value="name1"&gt;name1&lt;/option&gt;
  &lt;option value="name2"&gt;name2&lt;/option&gt;
  &lt;option value="name3"&gt;name3&lt;/option&gt;
  &lt;option value="name4"&gt;name4&lt;/option&gt;
  &lt;/select&gt;&lt;br&gt;
  &lt;input type="submit" name="submit" value="Insert"&gt;
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  &lt;?php
  if(isset($_GET['submit']))
  {
      $name=$_GET['name'];
      $c=mysql_connect("localhost","root","");
      mysql_select_db("test");
      $ins=mysql_query("insert into option (name) values ('$name')",$c);
      if($ins)
      {
          echo "&lt;br&gt;".$name."inserted";
      }
      else
      {
          echo mysql_error();
      }
  }
  ?&gt;
  </code></pre>
  
  <p>when i am trying out put showing  this error</p>
  
  <p>You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'option (name) values ('name3')' at line 1</p>
  
  <p>Thank you..,</p>