title: PHP Contact Form question $_POST, $_GET $_SESSION
body: <p><strong>EDIT:</strong></p>
  
  <p>So my remaining questions are: (1) should I use a 302 or 303 for the header() redirect? I believe 303 is the proper way. (2) Is $_SESSION the best way to pass variables to the ?contact=thankyou page?</p>
  
  <p>My revised code:</p>
  
  <pre><code>if ( isset( $_POST[ 'submit' ] ) )
  {
    if ( is_bot() )
    {
      header( "Location: http://www.example.com/contact/?contact=thankyou",
          TRUE, 303 );
      exit;
    }
    elseif ( is_input_error() )
    {
      // show error form stuff...
    }
    else
    {
      contact_send_email();
      header( "Location: http://www.example.com/contact/?contact=thankyou",
          TRUE, 303 );
      exit;
    }
  }
  </code></pre>
  
  <p><strong>ORIGINAL (resolved):</strong></p>
  
  <p>I am just learning about $_POST, $_GET and forms with PHP. I have a Contact Form that started out simple, but has now become a little complicated for my experience.</p>
  
  <pre><code>// curly braces left out for brevity
  if ( isset( $_POST[ 'submit' ] ) )
    if ( is_bot() )
      header( "Location: http://www.example.com/contact/?contact=thankyou", 
              TRUE, 303 );
    if ( is_input_error() )
      header( "Location: http://www.example.com/contact/?contact=error", 
              TRUE, 303 );
    else
      contact_send_email()
      header( "Location: http://www.example.com/contact/?contact=thankyou", 
              TRUE, 303 );
  </code></pre>
  
  <ol>
  <li>Being new at this, I guess I'd like to know if you see any glaring problems?</li>
  <li>Does my <code>header()</code> redirect code look complete and valid?</li>
  <li>What is the most common and/or recommended way to pass <code>$_POST</code> variables after the <code>header()</code> redirection? Is it with <code>$_SESSION</code>, or is there a better way? I've never used sessions before, so I am a little intimidated by them.</li>
  </ol>
  
  <p><strong>EDIT:</strong> By the way, I want to pass the <code>header()</code> redirect with <code>$_GET</code> to avoid the "refresh-resend" very scary and evil warning message.</p>