title: Unable to insert data into mysqli database
body: <p>Js fiddle to have a look into form:<a href="http://jsfiddle.net/aBp34/" rel="nofollow">http://jsfiddle.net/aBp34/</a>
   The form working finely ,it's just that I'm unable to insert any data into the database.
   Surprisingly there's no error generated!</p>
  
  <p><strong>*ERROR: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 ''name','nric','hp','gender','occupation','ins_orga','events','size')VALUES(kalai' at line 1*</strong> </p>
  
  <p>Below is the mysqli commands in php:
   Any help would be appreciated :)</p>
  
  <pre><code>    &lt;?php
          if(isset($_POST['submitted']))
          {
              if(empty($_POST['name']))
              {
                  $name=NULL;
                  echo'Please fill up your name!'.'&lt;/br&gt;';
              }
              else
              //to check name(char only)
                  if(!empty($_POST['name']))
                  {
                      $name=$_POST['name'];
                      $pattern='/([[:alpha:]]|[[:space:]])/';
                      if(!preg_match($pattern, $name))//slighly silly but it echo only if preg_match mismatch
                      {
                          echo 'Please key in a valid name!'.'&lt;/br&gt;';
                      }
                  }
               // to check NRIC(only numbers and size=12) 
                  if(empty($_POST['nric']))
                  {
                      $nric=NULL;
                      echo'Please key in your NRIC!'.'&lt;/br&gt;';
                  }
              else
                  if(!empty($_POST['nric']))
                  {
                      $nric=$_POST['nric'];
                      $pattern='/[0-9]{12}/';
                      if(!preg_match($pattern, $nric))
                      {
                          echo 'Please key in a valid NRIC number!'.'&lt;/br&gt;';
                      }
                  }
                  //to check h/p number
                  if(empty($_POST['hp']))
                  {
                      $hp=NULL;
                      echo'Please key in your H/P Number!'.'&lt;/br&gt;';
                  }
                  else
                  if(!empty($_POST['hp']))
                  {
                      $hp=$_POST['hp'];
                      $pattern='/(\\d{10})/';
                      if(!preg_match($pattern, $hp))
                      {
                          echo 'Please key in a valid Mobile number!'.'&lt;/br&gt;';
                      }
                  }
  
                  //to check email
  
                  if(empty($_POST['email']))
                  {
                      $email=NULL;
                      echo'Please key in your email id!';
                  }
                  else
                  if(!empty($_POST['email']))
                  {
                      $hp=$_POST['email'];
                      $pattern='/^(?!(?&gt;"?(?&gt;\\\[ -~]|[^"])"?){255,})(?!"?(?&gt;\\\[ -~]|[^"]){65,}"?@)(?&gt;([!#-\'*+\/-9=?^-~-]+)(?&gt;\.(?1))*|"(?&gt;[ !#-\[\]-~]|\\\[ -~])*")@(?!.*[^.]{64,})(?&gt;([a-z\d](?&gt;[a-z\d-]*[a-z\d])?)(?&gt;\.(?2)){0,126}|\[(?:(?&gt;IPv6:(?&gt;([a-f\d]{1,4})(?&gt;:(?3)){7}|(?!(?:.*[a-f\d][:\]]){8,})((?3)(?&gt;:(?3)){0,6})?::(?4)?))|(?&gt;(?&gt;IPv6:(?&gt;(?3)(?&gt;:(?3)){5}:|(?!(?:.*[a-f\d]:){6,})(?5)?::(?&gt;((?3)(?&gt;:(?3)){0,4}):)?))?(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)(?&gt;\.(?6)){3}))\])$/iD';
                      if(!preg_match($pattern, $hp))
                      {
                          echo 'Please key in a valid email id!'.'&lt;/br&gt;';
                      }
                  }
  
                  //to check gender
  
                  if(!isset($_POST['gender']))
                  {
                      $gender=NULL;
                      echo"Kindly select your gender!".'&lt;/br&gt;';
                  }
                  else
                  {
                      $gender=$_POST['gender'];
                  }
                  //to check occupation
  
                  if(!isset($_POST['occupation']))
                  {
                      $occupation=NULL;
                      echo"Kindly select your occupation!".'&lt;/br&gt;';
                  }
                  else
                  {
                      $occupation=$_POST['occupation'];
                      if(empty($_POST['ins_orga']))
                      {
                          echo'Please name your institution or organization!';
                      }
                      else
                      {
                          $ins_orga=$_POST['ins_orga'];
                      }
                  }
  
                  //to check events
  
                   if(!empty($_POST['events']))    
                  {
                       $events = $_POST['events'];
  
                  }
                  if(!isset($events)) 
                  {
                   echo("&lt;p&gt;You didn't select any events!&lt;/p&gt;\n").'&lt;/br&gt;';
                  } 
                  else
                  {
                  $nevents = count($events);
  
                  echo"You selected ".$nevents ."events: ".'&lt;/br&gt;';
                  for($i=0; $i &lt; $nevents; $i++)
                  {
                   echo($events[$i] . " ");
                  }
  
  
                  }
  
                  if(empty($_POST['size']))
                  {
  
                  echo"please select your size".'&lt;/br&gt;';
  
                  }
                  else
                  {
                    $size=$_POST['size'];
                    echo $size;
  
                  }
  
                  if(isset($_POST['area']))
                  {
                      $area=$_POST['area'];
                  }
                  if(isset($_POST['captain_code']))
                  {
                      $captain_code=$_POST['captain_code'];
                  }
                  if(isset($_POST['address']))
                  {
                      $address=$_POST['address'];
                  }
                  if(isset($_POST['s1']))
                  {
                     $s1=$_POST['s1']; 
                  }
                  // check all
  
                  if('$name'&amp;&amp;'$nric'&amp;&amp;'$hp'&amp;&amp;'$email'&amp;&amp;'$gender'&amp;&amp;'$occupation'&amp;&amp;'$events'&amp;&amp;'$size')
                  {
  
                      echo "you have successfully registered! Your code is: ";
                      // set uniqid
  
                      $order_id = uniqid(rand(10,1000),false);
                      $order_id = substr($order_id,rand(0,strlen($order_id) - 4),4);
                      echo hexdec($order_id);              
                      $mysqli=new mysqli('localhost','root','','volunteer-registration');
                      if(mysqli_connect_errno())
                      {
                          echo 'Connection failed',  mysql_connect_error();
                          exit();
                      }
  
  
  
  
                      $insert="INSERT INTO volunteer_registration(name,nric,hp,email_id,address,gender,occupation,ins_orga,events,size,area,s1,captain_code)VALUES($name,$nric,$hp,$email,$address,$gender,$occupation,$ins_orga,$events,$size,$area,$s1,$captain_code)";
                      $query=  mysqli_query($mysqli, $insert)or die(mysqli_error($mysqli));
  
  
  
                  }
                  }
          ?&gt;
  </code></pre>