| | |
Cannot modify header information......
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Feb 2009
Posts: 2
Reputation:
Solved Threads: 0
Warning: Cannot modify header information - headers already sent by (output started at /home/mysite/public_html/redirect_index.php:20) in /home/mysite/public_html/redirect_index.php on line 38
I've converting as asp site to php. I'm a partial numpty in asp and complete numpty in php
I keep being told this is a white space problem..... I can't see it!
The code below is a redirect: from one page to another where a Yes or No is clicked and then redirected accordingly.
The asp code was "converted" to php using a conversion prog, so anything could have happened! Maybe the sequence of events is incorrect?
Any advice greatly appreciated.
I've converting as asp site to php. I'm a partial numpty in asp and complete numpty in php
I keep being told this is a white space problem..... I can't see it!
The code below is a redirect: from one page to another where a Yes or No is clicked and then redirected accordingly.
The asp code was "converted" to php using a conversion prog, so anything could have happened! Maybe the sequence of events is incorrect?
Any advice greatly appreciated.
php Syntax (Toggle Plain Text)
<? if(${"SubArea"}=="N") { ?> <? setcookie("Copyright2009","do not agree",0,"","",0); ?> <? header("Location: "."copyrightNotAgree.php");?> <? }?> <? $strTemp=$_COOKIE["Copyright2009"];?> <? echo $strTemp;?> <? if($strTemp=="agree") { ?> <? header("Location: "."index2.php");?> <? } else { ?> <? if(${"SubArea"}=="Y") { ?> <? setcookie("Copyright2009","agree",0,"","",0); ?><?php //Calculate 30 days in the future //seconds * minutes * hours * days + current time $inOneMonth = 60 * 60 * 24 * 30 + time(); setcookie('lastVisit', date("G:i - m/d/y"), $inOneMonth); ?> <? $URL="http://www.mysite.com/index2.php";?> <? } else { ?> <? header("Location: copyright.php");?> (this is line 38 referred to in the error message) <? } ?> <? } ?>
Last edited by peter_budo; Feb 3rd, 2009 at 1:46 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
You can't have anything echoed to the screen (including whitespace) before the header() function.
will ensure your code goes "t*** up".
PHP Syntax (Toggle Plain Text)
<? echo $strTemp;?>
will ensure your code goes "t*** up".
Last edited by ardav; Feb 1st, 2009 at 8:55 am.
Tyra Banks is getting fat.
![]() |
Similar Threads
- PHP Warning: Cannot modify header information - headers already sent by (output ..... (PHP)
- Warning: Cannot modify header information (PHP)
- "Cannot modify header information - headers already sent by..." error (PHP)
- Cannot modify header information.Headers already sent (PHP)
- header information error (PHP)
Other Threads in the PHP Forum
- Previous Thread: Page not found
- Next Thread: I want to use javascript on PHP page.
| Thread Tools | Search this Thread |
access ajax alexa apache api array beginner binary broken cakephp checkbox class cms code cron curl database date directory display dropdown dynamic echo email encode error fairness file files folder form forms function functions google href htaccess html image include indentedsubcategory insert integration ip java javascript joomla limit link login loop mail mail() menu mlm multiple multipletables mysql newsletters oop passwords paypal pdf php problem provider query radio random recursion regex remote script search secure server sessions simple sms soap source space sql syntax system table tutorial update upload url user validation validator variable variables video voteup web xml youtube






