title: Submitting HTML data to a google App Engine MySQL database using PHP
body: <p>I have been trying to create a simple web form that will be used to submit data to a Google App Engine database that uses MySQL. The database is connecting fine and the try catch statement seems to be working properly. The problem is that when i click the submit button, the data is not being committed into the database. Any help would be much appreciated, I'm sure there is just some small error that i am overlooking. </p>
  
  <p>HTML form</p>
  
  <pre><code>                    &lt;form class="form-horizontal" role="form" action="connection.php" method="post"&gt;
                      &lt;div class="form-group"&gt;
                           &lt;label for="patientName" class="col-sm-2 control-label"&gt;Patient Name&lt;/label&gt;
                          &lt;div class="col-sm-10"&gt;
                              &lt;input type="Name" class="form-control" id="patientName" name="patientName"&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                      &lt;div class="form-group"&gt;
                           &lt;label for="Address1" class="col-sm-2 control-label"&gt;Address 1&lt;/label&gt;
                          &lt;div class="col-sm-10"&gt;
                              &lt;input type="text" class="form-control" rows='3' id="Address1" name="Address1"&gt;&lt;/input&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                      &lt;div class="form-group"&gt;
                           &lt;label for="Address2" class="col-sm-2 control-label"&gt;Address 2&lt;/label&gt;
                          &lt;div class="col-sm-10"&gt;
                              &lt;input type="text" class="form-control" rows='3' id="Address2" name="Address2"&gt;&lt;/input&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                      &lt;div class="form-group"&gt;
                           &lt;label for="Address3" class="col-sm-2 control-label"&gt;Address 3&lt;/label&gt;
                          &lt;div class="col-sm-10"&gt;
                              &lt;input type="text" class="form-control" rows='3' id="Address3" name="Address3"&gt;&lt;/input&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                      &lt;div class="form-group"&gt;
                           &lt;label for="postCode" class="col-sm-2 control-label"&gt;PostCode&lt;/label&gt;
                          &lt;div class="col-sm-10"&gt;
                              &lt;input type="text" class="form-control" id="postCode" name="postCode"&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                      &lt;div class="form-group"&gt;
                           &lt;label for="symptoms" class="col-sm-2 control-label"&gt;Symptoms&lt;/label&gt;
                          &lt;div class="col-sm-10"&gt;
                              &lt;textarea type="text" class="form-control" rows='5' id="symptoms" name="symptoms"&gt;&lt;/textarea&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                      &lt;div class="form-group"&gt;
                           &lt;label for="contactNumber" class="col-sm-2 control-label"&gt;Contact Number&lt;/label&gt;
                          &lt;div class="col-sm-10"&gt;
                              &lt;input type="Tel" class="form-control" id="contactNumber" name="contactNumber"&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                      &lt;div class="form-group"&gt;
                          &lt;div class="col-sm-offset-2 col-sm-10"&gt;
                               &lt;button type="submit" class="btn btn-default"&gt;Log Call Details&lt;/button&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                  &lt;/form&gt;
  </code></pre>
  
  <p>PHP connection file</p>
  
  <pre><code>&lt;?php
  
  use google\appengine\api\users\User;
  use google\appengine\api\users\UserService;
  
  try {
  $db = new pdo('mysql:host=111.111.111.11:3306;dbname=MyDB',
  'root',
  'password'
  );
  
  $patientName = $_POST["patientName"];
  $address1 = $_POST["Address1"];
  $address2 = $_POST["Address2"];
  $address3 = $_POST["Address3"];
  $postCode = $_POST["postCode"];
  $symptoms = $_POST["symptoms"];
  $contactNumber = $_POST["contactNumber"];
  
  $sql = "INSERT INTO patient (patientName, patientAddress1, patientAddress2, patientAddress3, patientPostcode, PatientSymptoms, patientPhoneNumber)
  VALUES ($patientName, $address1, $address2, $address3, $postCode, $symptoms, $contactNumber)";
  
  
  $db-&gt;execute($sql);
  
  
  } catch (PDOException $ex) {
  echo "Could not connect to the database.";
  exit;
  }
  
  $db = null;
  echo "Woo-hoo!";
  ?&gt;
  </code></pre>
  
  <p>I should probably also mention that the HTML page is using bootstrap.</p>