title: Redisplaying a form with fields filled in
body: <p>I need a bit of help with redisplaying a form.</p>
  
  <p>Basically, currently a user will fill out my contact form, the form and it's contents are passed to my verification page, and if the recaptcha was entered correctly it goes to a Thank You page.</p>
  
  <p>When the recaptcha is entered INCORRECTLY, I want to redisplay the contact form with the fields already filled out. How do I do this? (As you'll see below, it currently goes to google on incorrect captcha)</p>
  
  <p>Here is my verification code. Any help would be great:</p>
  
  <pre><code>&lt;?php require('sbsquared.class.php'); ?&gt;
  &lt;?php
    require_once('recaptchalib.php');
    $privatekey = "myprivatekey";
    $resp = recaptcha_check_answer ($privatekey,
                                  $_SERVER["REMOTE_ADDR"],
                                  $_POST["recaptcha_challenge_field"],
                                  $_POST["recaptcha_response_field"]);
  
    if (!$resp-&gt;is_valid) {
      // What happens when the CAPTCHA was entered incorrectly
      header("Location: http://www.google.com");  &lt;--- this is the bit that I want to redisplay the form with fields already filled out.
    } else {
  
      $sb = New SBSquared;
  
      $name = $_POST['FullName'];
      $post_keys = array_keys($_POST);
      $my_db_string = "&lt;table&gt;";
      $ip_address = $_SERVER['REMOTE_ADDR'];
      foreach($post_keys as $field)
      {
          if($_POST[$field] != "" &amp;&amp; $field != "submit_y" &amp;&amp; $field != "submit_x" &amp;&amp; $field != "submit_x")
          {
  
              $my_db_string .= "&lt;tr&gt;&lt;td&gt;&lt;b&gt;".$field.":&lt;/b&gt;&lt;/td&gt;&lt;td&gt;";
              if($field == "Email")
              {
                  $my_db_string .= '&lt;a href = "mailto:'.$_POST['Email'].'"&gt;'.$_POST['Email'].'&lt;/a&gt;';
              }
              else
              {
                  $my_db_string .= $_POST[$field];
              }
  
              $my_db_string .= "&lt;/td&gt;&lt;/tr&gt;";
  
          }
      }
  
      $my_db_string .= "&lt;tr&gt;&lt;td&gt;&lt;b&gt;IP ADDRESS LOGGED: &lt;/b&gt;&lt;/td&gt;&lt;td&gt;".$ip_address."&lt;/td&gt;&lt;/tr&gt;";
  
      $my_db_string .= "&lt;/table&gt;";
  
      if(get_magic_quotes_gpc() != 1)
      {
          $my_db_string = addslashes($my_db_string);
          $name = addslashes($name);
      }
  
      $conn = $sb-&gt;openConnection();
      $dts = time();
      $sql = "INSERT INTO `contact_queries` VALUES ('', '$name', '$my_db_string', 'n/a', 0, $dts)";
      $result = mysql_query($sql, $conn) or die(mysql_error());
  
  $content = '&lt;div id="main_middle"&gt;';
  
  $content .= '&lt;span class="title"&gt;'.$sb-&gt;dt('Contact').'&lt;/span&gt;
  &lt;p&gt;'.$sb-&gt;dt('Thank you for your enquiry. We will contact you shortly.').'&lt;/p&gt;
  
  
  &lt;/div&gt;';
  
  // admin auto email.
          $dts = date("d.m.y h:ia", time());
          $admin_content = "New contact query at $dts";
          $admin_content .= "\n\n--\n\n \r\n\r\n";
          mail("email address", 'NOTIFICATION: new query', $admin_content, 'From: email address');
          $FILE=fopen("./log/auto-contact.txt","a");
          fwrite($FILE, $admin_content);
          fclose($FILE);
  
  echo pageHeader($sb);
  echo pageContent($sb, $content);
  echo pageFooter($sb);
    }
  ?&gt;
  </code></pre>