title: Input Errors - Redirect back to registration page, display error message
body: <p>I have the following code which will check to see if the following fields produced an error:</p>
  
  <pre><code>//Input Validations
  if($user_name == '') {
      $errmsg_arr[] = 'Username missing';
      $errflag = true;
  }
  if($user_password == '') {
      $errmsg_arr[] = 'Username Password missing';
      $errflag = true;
  }
  if($insp_name == '') {
      $errmsg_arr[] = 'Inspector Name missing';
      $errflag = true;
  }
  if($insp_email == '') {
      $errmsg_arr[] = 'Inspector Email missing';
      $errflag = true;
  }
  if($confirm_password == '') {
      $errmsg_arr[] = 'Confirm Password missing';
      $errflag = true;
  }       
  
  if ($user_password != $confirm_password) { 
          $errmsg_arr[] = 'The password which you have entered do not match';
      $errflag = true;
     }
  
  $result = mysql_query("SELECT * FROM members WHERE `email` = '$insp_email' or `login` = '$user_name' LIMIT 1" ); 
  $exist = mysql_fetch_row($result); 
      if ($exist !==false ) { 
         $errmsg_arr[] = 'That email is already registered.';
         $errflag = true;
         }
  
  //If there are input validations, redirect back to the registration form
  if($errflag) {
      $_SESSION['ERRMSG_ARR'] = $errmsg_arr;
      session_write_close();
      header("location: accountinfo.php");
      exit();
  }
  </code></pre>
  
  <p>If an error was produced once the user is redirected back to the registration page, no error message displays.  So the user has no idea why they were redirected back to the registration page.  How can I get it so that once they are redirected back to the registration page, it will display an error message stating what the problem was? Ex. Username was missing, or email already registered.  I want to display the error message pertaining to the error that caused them to be redirected back to the registration page.</p>