Jump to content

Recommended Posts

I get this warning when I am trying to refresh the page to a different one:

 


Warning: Cannot modify header information - headers already sent by (output started at /home/ada/public_html/v2/ada_login/main.php:9) in /home/ada/public_html/v2/ada_login/main.php on line 36

 

Here is the code:

<?php
if($session->logged_in){
header("Refresh: 3 url=welcome.php?uid=$session->userid");
        echo '<h3>Creating workspace</h3>';
echo '<img src="images/loader.gif" />';
}
?>

Link to comment
https://forums.phpfreaks.com/topic/184585-header-warning/
Share on other sites

It is generally better to code for output buffer off, especially if you plan on selling or giving the script away. But it also depends on what you are doing, for instance, if you plan on gzipping your pages up, it would be better to have output buffer on so you can serve that out easier.

 

But for most scripts you should have it off and do proper coding where you store output in a variable and echo it out at the end of the script, so you do not mix processing with outputting, to avoid errors such as this no matter the circumstance. That and output buffering is considered a "bandaid" for solving header errors.

Link to comment
https://forums.phpfreaks.com/topic/184585-header-warning/#findComment-974487
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.