title: storing enum type variable into database
body: <p>I have my registerUsers.html as below</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;userlogin&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;h1&gt;&lt;center&gt;User login&lt;/center&gt;&lt;/h1&gt;
  &lt;p&gt;
  &lt;strong&gt;&lt;font color= "green"&gt; REGISTER HERE &lt;/font&gt;&lt;/strong&gt;
  &lt;br&gt;
  &lt;form method="post" action="registerUsers.php"&gt;
  &lt;p&gt;&lt;strong&gt;ID:&lt;/strong&gt;&lt;br/&gt;
  &lt;input type="text" name="id"/&gt;&lt;/p&gt;
  &lt;p&gt;&lt;strong&gt;FirstName:&lt;/strong&gt;&lt;br/&gt;
  &lt;input type="text" name="firstname"/&gt;&lt;/p&gt;
  &lt;p&gt;&lt;strong&gt;Lastname:&lt;/strong&gt;&lt;br/&gt;
  &lt;input type="text" name="lastname"/&gt;&lt;/p&gt;
  &lt;p&gt;&lt;strong&gt;Username:&lt;/strong&gt;&lt;br/&gt;
  &lt;input type="text" name="username"/&gt;&lt;/p&gt;
  &lt;p&gt;&lt;strong&gt;Password:&lt;/strong&gt;&lt;br/&gt;
  &lt;input type="password" name="password"/&gt;&lt;/p&gt;
  Admin &lt;input type="radio" name="type" value="admin" /&gt;&lt;br /&gt;
  Author &lt;input type="radio" name="type" value="author" checked="checked"/&gt;
  &lt;p&gt;&lt;input type="submit" name="submit" value="Register"/&gt;&lt;/p&gt;
  &lt;/form&gt;
  &lt;/p&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>and registerUsers.php as below</p>
  
  <pre><code>&lt;?php
  include("dbconnect.php");
  $con=new dbconnect();
  $con-&gt;connect();
  if(isset($_POST['submit'])) {
         $type=0;
  
          if($_POST['type'] =="admin")
          $type = 1;
          if($_POST['type'] =="author")
          $type = 0;
  
      $sSql = "INSERT INTO users 
           ( id, first_name, last_name,username, password, type)
           VALUES ('$_POST[id]', '$_POST[firstname]', '$_POST[lastname]', '$_POST[username]', PASSWORD(\"$_POST[password]\"), $type)";
  
      mysql_query($sSql);
  
      echo '&lt;h2&gt;USER REGISTERED&lt;/h2&gt;&lt;br /&gt;';
  }
  ?&gt;
  </code></pre>
  
  <p>When I am selecting 'author' radio button nothing is getting stored in the 'type' variable of the database. If I select admin, 'admin' is stored in type variable. How can I fix this so that 'author' can be stored in the 'users' table of the database.</p>
  
  <p>Any thoughts or help would be appreciated.
  Thanks!</p>