title: Registration form - creating new entries to a table
body: <p>im trying to create a table that collects data from a registration form and wanted to add a couple lines (zip,state,etc..) The code works fine(name, email, username,etc..) besides the lines i added. Any idea why the others get moved fine and the newest entries do not get moved they just seem to disappear. </p>
  
  <p><strong>UPDATE: 5-2-13 11:07AM EST 
  Error when submitting form</strong></p>
  
  <pre><code> Error inserting data to the table
  query:insert into users(
  name,
  lastname,
  email,
  username,
  password,
  zipcode,
  country,
  phonenumber,
  address,
  city,
  state,
  confirmcode
  values
  (
  "Lucas",
  "Weir",
  "lucas@12miletechs.com",
  "qualitygoods11",
  "2aeac48777d7d33ac22cb0c1bac45bf3",
  "48178",
  "Usa",
  "248xxx8851",
  "XXXX Hen Rd.",
  "South Lyon",
  "MI",
  "18456d8a76e3337cebb1fec161c50291"
  )
  mysqlerror: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 'values
  (
  "Lucas",
  "Weir",
  "lucas@12miletechs.com",
  "qua' at line 14
  Inserting to Database failed!
  </code></pre>
  
  <p>CODE:</p>
  
  <pre><code>function CollectRegistrationSubmission(&amp;$formvars)
          {
              $formvars['name'] = $this-&gt;Sanitize($_POST['name']);
              $formvars['email'] = $this-&gt;Sanitize($_POST['email']);
              $formvars['username'] = $this-&gt;Sanitize($_POST['username']);
              $formvars['password'] = $this-&gt;Sanitize($_POST['password']);
              $formvars['lastname'] = $this-&gt;Sanitize($_POST['lastname']);
              $formvars['zipcode'] = $this-&gt;Sanitize($_POST['zipcode']);
              $formvars['country'] = $this-&gt;Sanitize($_POST['country']);
              $formvars['phonenumber'] = $this-&gt;Sanitize($_POST['phonenumber']);
              $formvars['address'] = $this-&gt;Sanitize($_POST['address']);      
              $formvars['city'] = $this-&gt;Sanitize($_POST['city']);
              $formvars['state'] = $this-&gt;Sanitize($_POST['state']);
          }
  
  function InsertIntoDB(&amp;$formvars)
  {
  
      $confirmcode = $this-&gt;MakeConfirmationMd5($formvars['email']);
  
      $formvars['confirmcode'] = $confirmcode;
  
      $insert_query = 'insert into '.$this-&gt;tablename.'(
              name,
              email,
              username,
              password,
              zipcode,
              country,
              phonenumber,
              address,
              city,
              state,
              confirmcode
              )
              values
              (
              "' . $this-&gt;SanitizeForSQL($formvars['name']) . '",
              "' . $this-&gt;SanitizeForSQL($formvars['email']) . '",
              "' . $this-&gt;SanitizeForSQL($formvars['username']) . '",
              "' . md5($formvars['password']) . '",
              "' . $this-&gt;SanitizeForSQL($formvars['zipcode']) . '",
              "' . $this-&gt;SanitizeForSQL($formvars['country']) . '",
              "' . $this-&gt;SanitizeForSQL($formvars['phonenumber']) . '",
              "' . $this-&gt;SanitizeForSQL($formvars['address']) . '",
              "' . $this-&gt;SanitizeForSQL($formvars['city']) . '",
              "' . $this-&gt;SanitizeForSQL($formvars['state']) . '",
              "' . $confirmcode . '"
              )';      
      if(!mysql_query( $insert_query ,$this-&gt;connection))
      {
          $this-&gt;HandleDBError("Error inserting data to the table\nquery:$insert_query");
          return false;
      }        
      return true;
  }
  </code></pre>