title: PHP form not writing to mySQL database
body: <p>I'm just learning PHP and am trying the most basic thing: capturing info from a form and sticking it into a table in a mySQL database.  I'm embarrassed to ask such a stupid newbie question, but after reviewing two books, several Stack Overflow posts, and 7 different tutorials, I still can't get my pathetic code to write a few lousy metrics to my database.  </p>
  
  <p>Here's the latest version of the code.  Could someone please tell me what I am doing wrong?</p>
  
  <p><strong>* Basic HTML Form *</strong></p>
  
  <pre><code>&lt;form method="post" action="post_metrics_stack.php" &gt;
  &lt;p&gt;Date&lt;br /&gt;
  &lt;input name="date" type="text" /&gt;&lt;/p&gt;
  
  &lt;p&gt;Metric1&lt;br /&gt;
  &lt;input name="metric1" type="text" /&gt;&lt;/p&gt;
  
  &lt;p&gt;Metric2&lt;br /&gt;
  &lt;input name="metric2" type="text" /&gt;&lt;/p&gt;
  
  &lt;input type="submit" name="submit" value="Submit" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p><strong>* Processor File *</strong></p>
  
  <pre><code>&lt;?php 
  
  $date=$_POST['date'];
  $metric1=$_POST['metric1'];
  $metric2=$_POST['metric2'];
  
  $con = mysql_connect("localhost", "root", "mypassword");
  if (!$con)
    {die('Could not connect to mysql: ' . mysql_error());} 
  
  $mydb = mysql_select_db("mydatabasename");
  if (!$mydb)
    {die('Could not connect to database: ' . mysql_error());} 
  
  mysql_query("INSERT INTO my_metrics VALUES ('$date', '$metric1', '$metric2')"); 
   Print "Your metrics have been successfully added to the database."; 
  
  mysql_close($con);
  ?&gt; 
  </code></pre>