title: Adding Data to a MySQL Database from an HTML Form
body: <p>HI all i've a basic Web Form for putting data into a mysql database, I created code to report if i was connected to my Database correctly and it was so on completion of the form i tested it and it seems to do what i expected but when i goto my database no data was actually entered? I've tried this locally and on a server with both doing the same thing.  Here is my two .php forms for you to look that i used on my local machine to test in MAMP just incase i have done something wrong:</p>
  
  <p>virtualWalkLog.php</p>
  
  <pre><code>&lt;form action="hazardsform.php" method="POST"  /&gt;
    &lt;p&gt;ROUTE: &lt;input type="text" name="ROUTE" /&gt;&lt;/p&gt;
    &lt;p&gt;ADDRESS: &lt;input type="text" name="ADDRESS" /&gt;&lt;/p&gt;
    &lt;p&gt;LATITUDE: &lt;input type="text" name="LATITUDE" /&gt;&lt;/p&gt;
    &lt;p&gt;LONGITUDE: &lt;input type="text" name="LONGITUDE" /&gt;&lt;/p&gt;
    &lt;p&gt;HAZARD: &lt;input type="text" name="HAZARD" /&gt;&lt;/p&gt;
    &lt;p&gt;RISK: &lt;input type="text" name="RISK" /&gt;&lt;/p&gt;
    &lt;input type="submit" value="Submit" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>hazardsform.php</p>
  
  <pre><code>&lt;?php
  
  define('DB_NAME', 'virtualWalkLog');
  define('DB_USER', 'root');
  define('DB_PASSWORD', 'root');
  define('DB_HOST', 'localhost');
  
  $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
  
  if (!$link) {
       die('Could not connect: ' . mysql_error());
       }
  
       $db_selected = mysql_select_db(DB_NAME, $link);
  
       if (!$db_selected) {
       die('Can\'t use ' . DB_NAME . ': ' . mysql_error());
       }
  
       $value = $_POST['ROUTE'];
       $value = $_POST['ADDRESS'];
       $value = $_POST['LATITUDE'];
       $value = $_POST['LONGITUTE'];
       $value = $_POST['HAZARD'];
       $value = $_POST['RISK'];
  
       $sql = "INSERT INTO rmbhazards (ROUTE, ADDRESS, LATITUDE, LONGITUDE, HAZARD, RISK) VALUES ('$value', '$value2', 
       '$value3', '$value4', '$value5', '$value6')";
  
       mysql_close();
  </code></pre>
  
  <p>Many Thanks in advance</p>