Problem calling thankyou page url

Discussion in 'PHP' started by andreyp, Jun 27, 2011.

  1. #1
    Hi All,

    I have the following code that is supposed to call a thank you page url in a separate window once the form is submitted:


    f($result[tch_appSuccess] == 0){
    $lasttwo = substr($result["errorCode"], -2);
    if($result["errorCode"]== "1001" OR $lasttwo == "91" OR $lasttwo == "92" OR $lasttwo == "82" OR $lasttwo == "83" OR $lasttwo == "84"){
    // Lead was not submitted, email all info to the affiliate and exit
    $msg = $result["errorMsg"]. ":: Error Code ".$result["errorCode"];
    $failed_to_submit = "yes";
    include("pmi-email.php");
    header("Location: ".get_bloginfo('url').'/thankyou/');
    exit;
    }
    $error_field = $result['errorField'];
    $error_msg = $result['errorMsg'];


    However I get the following error:

    Warning: Cannot modify header information - headers already sent by (output started at /home/andreyp/public_html/wp-content/plugins/all-in-one-seo-pack/aioseop.class.php:221) in /home/andreyp/public_html/wp-content/themes/medical-active/quote-form/pmi-brain.php on line 79

    I've disabled the plugin that was causing it but still no luck.

    Is there a basic function that will just call thank you page url to open in separate window?

    Thank you
     
    andreyp, Jun 27, 2011 IP
  2. ntomsheck

    ntomsheck Peon

    Messages:
    87
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    This error is usually because you have this code below the DOCTYPE tag and the <head> tag. If true, move it above those. Should be easy since there are no echo statements built in.
     
    ntomsheck, Jun 27, 2011 IP
  3. I Stanley I

    I Stanley I Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Make sure you have nothing outputting to the browser prior to your redirect. Even whitespace. that will cause the headers to break. or turn on output buffering before you redirect.

    
    <?php
    ob_start();
    header("Location: ".get_bloginfo('url').'/thankyou/');
    ob_end_flush();
    
    Code (markup):
     
    I Stanley I, Jun 27, 2011 IP