title: I have a blank page after submitting a php mysqli update form,
body: <p>Hi I am trying to complete this update and It keeps sending me a blank page with no errors and not submitting the info into the DataBase. Everything works up to the point of the prepared statement as far as i can tell, it draws the id and the other variables no problem from the database and the previous search queries but wont let me go any further. Can anyone see where I have gone wrong, I just cant see it???    </p>
  
  <pre><code>&lt;html&gt;
                      &lt;head&gt;
                              &lt;title&gt;
                                  &lt;?php if ($id != '') { echo "Edit Record"; } else { echo "New Record"; } ?&gt;
                              &lt;/title&gt;
                              &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"/&gt;
                      &lt;/head&gt;
  
                      &lt;body&gt;
                              &lt;h1&gt;&lt;?php if ($id != '') { echo "Edit Record"; } else { echo "New Record"; } ?&gt;&lt;/h1&gt;
                              &lt;?php if ($error != '') {
                                      echo "&lt;div style='padding:4px; border:1px solid red; color:red'&gt;" . $error
                                              . "&lt;/div&gt;";
                              } ?&gt;
  
                              &lt;form action="" method="post"&gt;
                              &lt;div&gt;
                                      &lt;?php if ($id != '') { ?&gt;
                                              &lt;input type="hidden" name="id" value="&lt;?php echo $id; ?&gt;" /&gt;
                                              &lt;p&gt;ID: &lt;?php echo $id; ?&gt;&lt;/p&gt;
                                      &lt;?php } ?&gt;
  
                                      &lt;br&gt;&lt;strong&gt;Item Type: *  &lt;/strong&gt;&lt;input name="item_type" value="&lt;?php echo $item_type; ?&gt;" type="text"&gt;&lt;br&gt;
                                      &lt;br&gt;&lt;strong&gt;Location: *  &lt;/strong&gt;&lt;input name="location" value="&lt;?php echo $location; ?&gt;" type="text"&gt;&lt;br&gt;
                                      &lt;br&gt;&lt;strong&gt;Date Last Test: * &lt;/strong&gt;&lt;input name="date_last_test" value="&lt;?php echo $date_last_test; ?&gt;" type="date"&gt;&lt;br&gt;
                                      &lt;br&gt;&lt;strong&gt;Serial Number: *&lt;/strong&gt;&lt;input name="serial_number" value="&lt;?php echo $serial_number; ?&gt;" type="text"&gt;&lt;br&gt;
                                      &lt;br&gt;&lt;strong&gt;Date Next Test: *&lt;/strong&gt;&lt;input name="date_next_test" value="&lt;?php echo $date_next_test; ?&gt;" type="date"&gt;&lt;br&gt;
                                      &lt;br&gt;&lt;strong&gt;Comments: *&lt;/strong&gt;&lt;input name="comments" value="&lt;?php echo $comments; ?&gt;" type="text"&gt;&lt;br&gt;
  
                                      &lt;p style="text-align: left;"&gt;* required&lt;/p&gt;
                                      &lt;input name="submit" value="Submit" type="submit"&gt;&lt;div style="text-align: left;"&gt;
                              &lt;/div&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;
                          &lt;/body&gt;
                  &lt;/html&gt;
  </code></pre>
  
  <p>
  
  <pre><code>    /*
  
         EDIT RECORD
  
      */
      // if the 'id' variable is set in the URL, we know that we need to edit a record
      if (isset($_GET['id']))
      {
              // if the form's submit button is clicked, we need to process the form
              if (isset($_POST['submit']))
              {
                      // make sure the 'id' in the URL is valid
                      if (is_numeric($_POST['id']))
                      {
                              // get variables from the URL/form
                              $id = $_POST['id'];
                              $item_type = htmlentities($_POST['item_type'], ENT_QUOTES);
                              $location = htmlentities($_POST['location'], ENT_QUOTES);
                              $date_last_test = htmlentities($_POST['date_last_test'], ENT_QUOTES);
                              $serial_number = htmlentities($_POST['serial_number'], ENT_QUOTES);
                              $date_next_test = htmlentities($_POST['date_next_test'], ENT_QUOTES);
                              $comments = htmlentities($_POST['comments'], ENT_QUOTES);
  
  
                              // check that firstname and lastname are both not empty
                              if ($item_type == '' || $location == ''|| $date_last_test == ''|| $serial_number == ''|| $date_next_test == ''|| $comments == '' )
                              {
                                      // if they are empty, show an error message and display the form
                                      $error = 'ERROR: Please fill in all required fields!';
                                      renderForm($item_type, $location, $date_last_test, $serial_number, $date_next_test, $comments, $error, $id);
                              }
                              else
                              {
                                      // if everything is fine, update the record in the database
                                              if ($stmt = $mysqli-&gt;prepare("UPDATE `Calibration_and_Inspection_Register` SET `item_type` = ?, `location` = ?, `date_last_test` = ?, `serial_number` = ?, `date_next_test` = ?, `comments` = ?
                                              WHERE `id`=?"))
                                      {
                                              $stmt-&gt;bind_param("issdsds",`$id`, `$item_type`, `$location`, `$date_last_test`, `$serial_number`, `$date_next_test`, `$comments`);
                                              $stmt-&gt;execute();
                                              $stmt-&gt;close();
                                      }
  
                                      // show an error message if the query has an error
                                      else
                                      {
                                              echo "ERROR: could not prepare SQL statement.";
                                      }
                                      // redirect the user once the form is updated
                                      //header("Location: View Calibration and Inspection records.php");
                              }        
                      }
                     // if the 'id' variable is not valid, show an error message
                      else
                      {
                              echo "Error with ID !";
                      }
              }
              // if the form hasn't been submitted yet, get the info from the database and show the form
              else
              {
                      // make sure the 'id' value is valid
                      if (is_numeric($_GET['id']) &amp;&amp; $_GET['id'] &gt; 0)
                      {
                              // get 'id' from URL
                              $id = $_GET['id'];
  
                              // get the recod from the database
                              if($stmt = $mysqli-&gt;prepare("SELECT `item_type`,`location`,`date_last_test`,`serial_number`,`date_next_test`,`comments`,`id` FROM `Calibration_and_Inspection_Register` WHERE id=?"))
                              {
                                      $stmt-&gt;bind_param("i", $id);
                                      $stmt-&gt;execute();
  
                                      $stmt-&gt;bind_result($item_type, $location, $date_last_test, $serial_number, $date_next_test, $comments, $id);
                                      $stmt-&gt;fetch();
  
                                      // show the form
                                      renderForm($item_type, $location, $date_last_test, $serial_number, $date_next_test, $comments, $id);
  
                                      $stmt-&gt;close();
                              }
                              // show an error if the query has an error
                              else
                              {
                                     echo "Error: could not prepare SQL statement";
                              }
                      }
                   // if the 'id' value is not valid, redirect the user back to the view.php page
                     else
                      {
                             header("Location: View All Calibration and Inspection Records.php");
                      }
              }
      }
  </code></pre>