Jump to content
xisto Community
Sign in to follow this  
icedragn

Grrrr, Cookies Just Wont Work :(

Recommended Posts

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? :D**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.... :D:D , but ne ways, cookies workin great now :D

Share this post


Link to post
Share on other sites

Hi!! , icedragn :D 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.... :D // 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!! :D if something wrong........... i'm sorry but i think it's right!!! :D

Share this post


Link to post
Share on other sites

**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  :P

<{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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.