title: MySQL Database saving 0 values
body: <p>I have a form to take statistics for course registration at my university , one of the fields is the "studentid" connecting the form to the database seems to be successful and the primary field with auto increment is working just fine , however entering the student id and submitting the form fails every time and a new record is added with a "0" value ...</p>
  
  <p>this is the html code </p>
  
  <pre><code>     &lt;div class="content"&gt;
  
      &lt;form action="connect-mysql.php" method="POST" enctype="text/plain" id="form3" name="form3" method="post"&gt;
  
      &lt;table width="100%" border="0"&gt;
        &lt;tr&gt;
          &lt;td width="50%" bgcolor="#e3e3e3"&gt;&lt;center&gt;
          Student ID :
          &lt;/center&gt;&lt;/td&gt;
          &lt;td width="50%" bgcolor="#e3e3e3"&gt;
            &lt;span id="sprytextfield1"&gt;
            &lt;label for="studentid"&gt;&lt;/label&gt;
            &lt;input name="studentid" type="text" id="studentid" onblur="MM_validateForm('studentid','','NisNum');return document.MM_returnValue" maxlength="11" /&gt;
  *&lt;span class="textfieldRequiredMsg"&gt;A value is required.&lt;/span&gt;&lt;/span&gt;
          &lt;/td&gt;
  </code></pre>
  
  <p>PHP code </p>
  
  <pre><code>&lt;?php
  $host="fdb7.biz.nf" ;`enter code here`
  $username="1662822_db1" ;
  $password="421343" ;
  $db_name="1662822_db1" ;
  $tbl_name="courses" ;
      $dbcon = mysqli_connect("$host","$username","$password","$db_name") ;           
  
      if (!$dbcon) {
      die('error connecting to database'); }
  
      echo 'you have connected sucessfully' ; 
  
  // escape variables for security
  $studentid = mysqli_real_escape_string($dbcon, $_POST['studentid']);
  
  $sql="INSERT INTO courses (studentid)
  VALUES ('$studentid')";
  
  if (!mysqli_query($dbcon,$sql)) {
  die('Error: ' . mysqli_error($dbcon));
   }
   echo "1 record added"; 
      mysqli_close($dbcon);
    ?&gt;
  </code></pre>