title: PHP Code Inserting Empty Records Into MySQL DB
body: <p>My code inserts an empty record into the MySQL table "table1" instead of getting what inserted in the field "Name" in form1.html. 
  Any idea why it inserts an empty record instead of what the user entered in the field?</p>
  
  <p><strong>form1.html</strong></p>
  
  <pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
      "http://www.w3.org/TR/html4/strict.dtd"
      &gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
      &lt;title&gt;Insert Your Name&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;h3&gt; Insert Your Name&lt;/h3&gt;
      &lt;form action="form1.php" method="post"&gt;
          &lt;input type="text" name="Name"&gt;
              &lt;input type="Submit" value="Submit" name="Submit"&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>form.php</strong></p>
  
  <pre><code>&gt; &lt;?php 
  &gt; $connection =
  &gt; mysql_connect("localhost","root","")
  &gt; or die ("Couldn't Connect To Server");
  &gt; $db = mysql_select_db("db1",
  &gt; $connection) or die ("Couldn't Select
  &gt; Database"); $query = "CREATE TABLE IF
  &gt; NOT EXISTS table1 (Name VARCHAR(20))";
  &gt; $result = mysql_query($query) or die
  &gt; ("Query Failed: " . mysql_error());
  &gt; $query = "INSERT INTO table1 (Name)
  &gt; VALUES ('$_post[Name]')"; $result =
  &gt; mysql_query($query) or die ("Query
  &gt; Failed: " . mysql_error()); $query =
  &gt; "SELECT * FROM table1"; $result =
  &gt; mysql_query($query) or die ("Query
  &gt; Failed: " . mysql_error());
  &gt;     echo "&lt;TABLE BORDER = '1'&gt;";
  &gt;     echo "&lt;TR&gt;";
  &gt;     echo "&lt;TH&gt;Name&lt;/TH&gt;";
  &gt;     echo "&lt;/TR&gt;";
  &gt;     
  &gt;     while ($row = mysql_fetch_array($result))
  &gt;     {
  &gt;         echo "&lt;TR&gt;";
  &gt;         echo "&lt;TD&gt;", $row['name'], "&lt;/TD&gt;";
  &gt;         echo "&lt;/TR&gt;";
  &gt;     }
  &gt;     echo "&lt;/TABLE&gt;";
  &gt;     mysql_close($connection); ?&gt;
  </code></pre>