title: PHP form not posting to database
body: <p>it validates and displays the errors in my arrays properly, however it doesn't POST to my database. All the naming of fields is correct on the form (case correct too), PHP, and MYSQL, dbconnect.php are all correct and proper. The problem i believe is somewhere in the array function. Now I just started learning PHP this month so please go easy on me. Thanks for the help!</p>
  
  <pre><code>&lt;?php
  include ('scripts/dbconnect.php');
  $Name = mysql_real_escape_string($Name);
  $Email = mysql_real_escape_string($Email);
  
  if (isset($_POST['formsubmitted'])) {
  $error = array();//Declare An Array to store any error message  
  
  if (empty($_POST['Name'])) {//if no name has been supplied 
      $error[] = 'Please Enter Your Name ';//add to array "error"
      } else {
          $Name = $_POST['Name'];//else assign it a variable
      }
  
  if (preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/", $_POST['Email'])) { //regular expression for email validation
      $Email = $_POST['Email'];
      } else {
           $error[] = 'Your EMail Address is Invalid  ';
      }
  }
  if (empty($error)) //Send to database if no errors
      mysql_query("INSERT INTO InviteRequestDB ( 'Name', 'Email' ) VALUES ( '$Name', '$Email' )");
      mysql_close($connect); //Close connection to database
  
    foreach ($error as $key =&gt; $values) {
    echo "&lt;li style=color:#FFF&gt; $values &lt;/li&gt;";
    }
  </code></pre>
  
  <p>?></p>
  
  <p>Now I know I shouldn't be using mysql. But I ran into too many problems with mysqli and this is just a simple contact form.</p>
  
  <p>Also should I be doing mysql_real_escape_string on each variable as i am doing now? Or is the order of the procedure not correct?</p>
  
  <pre><code>&lt;form action="applyforinvite.php" method="post"&gt;
      &lt;input class="textbox" type="text" name="Name" /&gt;
      &lt;input class="textbox" type="text" name="Email" /&gt;
    &lt;input type="hidden" name="formsubmitted" value="TRUE" /&gt;
    &lt;input type="submit" value="Register" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Thanks for the help! </p>