title: Redirecting after completion of form action
body: <p>i am using the following code for form action, </p>
  
  <pre><code>// includes
  
  
  
  
  require_once('inc/mysql_wrapper.php');
  $DB=get_db_connection(); 
  require_once('inc/defines.inc.php');
  require_once('lib/functions.php');
  require_once('lib/framework.php');
  require_once('lib/specific.php');
  require_once('lib/table_editor.php');
  require_once('lib/user.php');
  require_once('models/basic.php');
  require_once('models/list.php');
  require_once('swiftmailer/lib/swift_required.php');
  require_once('recaptcha/recaptchalib.php');
  // end includes
  
  $q="SELECT value FROM $T_SETTINGS
  WHERE name='register'";
  $register=$DB-&gt;oq($q);
  
  $optin=get_setting("optin");
  
  // select custom fields if any
  $q="SELECT * FROM $T_FIELDS 
  WHERE list_id='$_GET[list_id]'
  ORDER BY id";
  $efields=$DB-&gt;aq($q);
  
  // select mailing list
  $q="SELECT * FROM $T_LISTS WHERE id='$_GET[list_id]'";
  $list=$DB-&gt;sq($q);
  
  if(!empty($_POST['ok']))
  {
      // validate recaptcha if required
      if($list['require_recaptcha'])
      {
          $resp = recaptcha_check_answer (RECAPTCHA_PRIVATE,
                                  $_SERVER["REMOTE_ADDR"],
                                  $_POST["recaptcha_challenge_field"],
                                  $_POST["recaptcha_response_field"]);
  
          if (!$resp-&gt;is_valid) 
          {
              $recaptcha_error="Looks like the words you entered are not correct!";        
              $template="templates/register.html";
              require_once('templates/master.html');
              exit;
          }                        
      }
  
      User::register($_POST, $efields, $optin);
  
      if(!empty($list['redirect_to']))
      {
          redirect($list['redirect_to']);
          exit;
      }
  
      $template="templates/message.html";
  }
  else
  {
      $template="templates/register.html";
  }
  
  require_once('templates/master.html');
  </code></pre>
  
  <p>excluding some other options, majorly the form data which this form recieves is</p>
  
  <blockquote>
    <p>name , email , ok (a flag to check that the the orginating form was submitted)</p>
  </blockquote>
  
  <p>how can I redirect this page to thanks.php when the form has been submitted?</p>