icedragn 0 Report post Posted December 12, 2004 Ok i have tried many tutorials and all tell me to do this:setcookie("uname", $name, time()+36000);But it always says:"Warning: Cannot modify header information - headers already sent"They say to put it on the very first line with no spaces, which i do, like this:<?php setcookie("mycookie", $name, time()+36000); ?>Im using IIS with XP Pro, and have PHP 4.3 installed... why wont it work? **edit, wow i cant believe no one could answer this EASY question, but after reading many documents, i figured out that i hadent declared the $name variable, meanwhile all the gay tutorials didnt happen to MENTION THIS LITTLE FACT.... , but ne ways, cookies workin great now Share this post Link to post Share on other sites
nancmu 0 Report post Posted December 15, 2004 Hi!! , icedragn I used to get this problem, it's easy to clear.... You might added function to display or html function before you set Cookie code, to solve it.... // do not add any code before this!!!<?phpob_start(); echo "................."; // can use "echo" function. setcookie("uname", $name, time()+36000); ........ echo ".............."; // can use "echo" function.ob_end_flush();?><html><head><meta ....>...... </html>this's ok!! if something wrong........... i'm sorry but i think it's right!!! Share this post Link to post Share on other sites
Zenchi 0 Report post Posted December 28, 2004 **edit, wow i cant believe no one could answer this EASY question, but after reading many documents, i figured out that i hadent declared the $name variable, meanwhile all the gay tutorials didnt happen to MENTION THIS LITTLE FACT.... , but ne ways, cookies workin great now <{POST_SNAPBACK}> General rule of thumb is to declare any $ variables, beit through and include or whatnot. Keep this in mind for the future, in case you ever decided to do a script. It can be a hassle and a half. Share this post Link to post Share on other sites