title: PHP Form - Return to original page after submission
body: <p>I have a very simple html page that calls a php script to submit data from a form to a database. Once the user has submitted their data it would be great if they could get a message that says they've been added successfully and then redirect them to the page with the form. The code i'm using is as follows:
  HTML file </p>
  
  <pre><code>&lt;html&gt; 
  &lt;body&gt; 
  &lt;form action="insertcustomer.php" method="post" &gt;
  
  &lt;p&gt;First Name: &lt;input type="text" name="firstname"&gt; 
  Last Name: &lt;input type="text" name="lastname"&gt; 
  &lt;P&gt;Phone: &lt;input type="text" name="phone"&gt; Email: &lt;input type="text" name="email"&gt;&lt;/P&gt; 
  Address1: &lt;input type="text"name="address1"&gt; Address2: &lt;input type="text" name="address2"&gt; City:&lt;input type="text" name="city"&gt;
  &lt;select name="Gender" id="Gender"&gt;
          &lt;option value=""&gt;Select One&lt;/option&gt;
          &lt;option value = "1"&gt;Female&lt;/option&gt;
          &lt;option value = "2"&gt;Male&lt;/option&gt;
  &lt;/select&gt; &lt;input value="Add" type="submit"&gt; &lt;/form&gt; &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>PHP file:</p>
  
  <pre><code>&lt;?php
  $con=mysqli_connect("centos-db.local","customerinfo","password","customerinfo");
  
   {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
   }
  $sql="INSERT INTO `customers` (`firstname`, `lastname`, `email`,
  `phone`, `address1`, `address2`, `city`, `gender`) VALUES
  ('$_POST[firstname]','$_POST[lastname]',
  '$_POST[email]','$_POST[phone]', '$_POST[address1]' ,'$_POST[address2]'
  ,'$_POST[city]' , '$_POST[gender]' )"; if (!mysqli_query($con,$sql))
   {
   die('Error: ' . mysqli_error($con));
  }
  echo "Customer Added"; mysqli_close($con); 
  ?&gt;
  </code></pre>
  
  <p>Any help you can give would be greatly appreciated!</p>
  
  <p>Cheers</p>