This is a discussion on "php header ( need help)" within the PHP Forum section. This forum, and the thread "php header ( need help) are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
php header ( need help)
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
php header ( need help)
helo
need help pls i wonder that there is an error on this code ... <?php ob_start(); header("location:login.php"); ?> error : Warning: Cannot modify header information - headers already sent by (output started at F:\Server\htdocs\fixed-1c\index.php:1) in F:\Server\htdocs\fixed-1c\index.php on line 3 |
|
|
|
||||
|
Re: php header ( need help)
You can only redirect when nothing has been written to the page. Ie, this will not work:
|
|
|||
|
Re: php header ( need help)
Why are you starting output buffering when you want to presumably perform an instant header redirect? In other words, do you really want the ob_start(); there...
I would always recommend shoving exit; ...directly after a call to header() to ensure that nothing else comes after that might send output to the browser and therefore cause the headers to be sent out and stop your header() call from working. |
![]() |
| Tags |
| php redirect |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| looking for new dog & cat header | mizbuffie | Graphics and 3D | 6 | Jun 18th, 2006 22:49 |
| Header Help | eulB | Graphics and 3D | 5 | Jun 12th, 2006 22:21 |
| Please help, I need a new header(s) | mizbuffie | Graphics and 3D | 2 | May 22nd, 2006 04:04 |