I'm having problems when I tried using a navigation script. The script works fine, except for one thing. When I put index.php?page=news, im given the news page. The problem is that when I try setting a cookie im given :
Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/index.php:8) in /var/www/html/myplace/login.php on line 93
Is there a way i could fix this without using iframes?
PHP Navigation Problems
Started by JoeVincetti, May 29 2005 09:54 PM
6 replies to this topic
#1
Posted 29 May 2005 - 09:54 PM
#2
Posted 29 May 2005 - 10:12 PM
where is the form posting to?
#3
Posted 29 May 2005 - 11:19 PM
I fixed the original problem, though a new problem has arose [Above^^]. Thanks for the quick response.
#4
Posted 29 May 2005 - 11:59 PM
... how about not sending the header information twice?
#5
Posted 30 May 2005 - 02:26 AM
In PHP, you must set cookies, change the header type, etc. before anything is sent to the browser. There are two ways to get around this.
One, move the setcookie function in your script so it above everything (<html>, doctype, etc.) so that it will be set before the page is loaded and the header error won't appear.
Two, if you must have the cookie where it is, you can use a little work around.
Above everything (<html>, doctype, everything), put:
Then right at the end of your page put:
One, move the setcookie function in your script so it above everything (<html>, doctype, etc.) so that it will be set before the page is loaded and the header error won't appear.
Two, if you must have the cookie where it is, you can use a little work around.
Above everything (<html>, doctype, everything), put:
<?php ob_start() ?>
Then right at the end of your page put:
<?php ob_end_flush() ?>
#6
Posted 30 May 2005 - 09:15 AM
Thanks A lot, I followed your advice and my page is working. Thanks again for the quick response.
#7
Posted 30 May 2005 - 09:17 AM
No problem
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users
