redirect print/Cannot modify header information - headers alreadysent

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • JRough

    redirect print/Cannot modify header information - headers alreadysent

    I have the following code at the end of a page that lists some query
    results. It starts in a form that asks the user for input, one of two
    template pages. One template is a form for user input if there is
    input otherwise it changes the template and lists the results on the
    other template page. That is why there is a $template variable.
    ====
    $template = "template_carli st.html";


    if ($_POST['assign']!='Open in Excel'){
    include "header.php ";
    include "footer.php ";

    }else{
    $file_name = str_replace('.p hp?','',$file_n ame);
    printxcl($data, $header,$file_n ame){
    }
    }else{
    $template = "clm_history_ph p.html";
    }

    include "header.php ";
    include $template_path. "$template" ;
    include "footer.php ";
    ===
    The only thing I need to fix is the printxcl function. That function
    has to be redirected away from the page somehow otherwise I get an
    error message because in header.php there is this line:
    *header( 'Content-type: text/html; charset=\"$CHAR SET\"' ) that is the
    conflict.
    which conflicts in the case the excel button is posted.

    So I get this error in the html:

    Warning: Cannot modify header information - headers already sent by
    (output started at /home/allrail/public_html/templates/header.php.html :
    15) in /home/allrail/public_html/header.php on line 39


    So how do I do I call the print command in my excel print function
    somewhere else so I don't get this conflict? Can I just redirect the
    print statement?

    The printxcl() needs to go to another page and not be called here
    because it includes a print function and it gives me the error
    message:
    Line 39 is the *header line above on the header.php page.

    thanks,

Working...