|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
cookie question
Can someone have a look at this code:
<?PHP session_start(); ?> <html> <head> <title> PHP Test </title> </head> <body bgcolor = "0033FF"> <?PHP $username = "testingcookies"; setcookie("user", $0username, time()+604800); /* Expires in a week */ ?> <p>Testing Cookies</p> </body> </html> and see if they can explain why it generates the error: Warning: Cannot add header information - headers already sent by (output started at c:\program files\apache group\apache\wwwroot\cookies.php:11) in c:\program files\apache group\apache\wwwroot\cookies.php on line 13 Thanks in Advance, Nick p.s. There are no whitespaces at the top. |
|
#2
|
|||
|
|||
|
they may be no white spaces, but your still sending the header out, you cant set a cookie, if you output anything
therefore, the very first line of your code needs to send out the cookie, no during the middle of the page, otherwise the headers has ready been sent |
|
#3
|
|||
|
|||
|
got it
Thanks ben. I realized right after I posted that this was the problem.
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > cookie question |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|