Page 1 of 1

setcookie

Posted: Sat Sep 21, 2002 4:40 pm
by jbdphp
Having trouble with the setcookie function this is what I get:

Warning: Cannot add header information - headers already sent by (output started at /home/ba/public_html/user/emailshow.php:13) in /home/ba/public_html/user/emailshow.php on line 74

Warning: Cannot add header information - headers already sent by (output started at /home/ba/public_html/user/emailshow.php:13) in /home/ba/public_html/user/emailshow.php on line 75

Code:

Code: Select all

<?php


                setcookie("yourname", "Justin", time() + (86400 * 30));
	setcookie("youremail", "hey@hey.net", time() + (86400 * 30));
				
// I even tried:
//@setcookie("yourname", "Justin", time() + (86400 * 30));
//still doesn't work!	

    echo "Thank you $yourname your message was sent!";
					

?>
Thanks in advance (note this code is from part of bigger script)

Posted: Sat Sep 21, 2002 5:22 pm
by hob_goblin
well, obviously, headers are being sent...

check for a space before the "<?" and make sure no html is being outputted

Posted: Sat Sep 21, 2002 7:08 pm
by Agent Dwarf
Yeah, it seems as though headers are sent, and you're not showing us the full code.

Tip: If you want to check if headers are sent during your code, use headers_sent().

Posted: Sun Sep 22, 2002 12:58 am
by Takuma
http://www.devnetwork.net/forums/viewtopic.php?t=1157

And also what on the line 13 of your code?