A couple problems may exist: 1) If you're trying to do this all in the same script, it's not going to work. You can't set a cookie and use it (with the value you've just set) in the same script (in the same request). You can only use cookies that have been sent back to your script from the browser. If you require the use of a cookie value you're trying to set, use your local variable's value, instead of trying to get the cookie.
2) I'm pretty sure there is not timeset() function in php. > setcookie("cookiename1","$domin","timeset()+1800"); And you've used it as a quoted string ... set a very funky, if not very invalid, expiry time, and hence didn't set the cookie at all. Try this instead: setcookie( "cookiename1", $domin, time()+1800 ); On a different request, you can retrieve $_COOKIE['cookiename1'] g.luck, ~Chris On Mon, 2 Sep 2002, skitum wrote: > Hi all, > > I'm using a cookie like this: > <<setcookie("cookiename1","$domin","timeset()+1800");>> at the top of my > script. <<$domin>> is a text field that belongs to a post form. This > form is in <<function one();>> well, i try use <<$domin>> in <<function > two();>> writing <<$_COOKIE['cookiename1'];>> Here you are the code: > > <? > setcookie("cookiename1","$domin","timeset()+1800"); > $cookiename1=$domin; > echo $cookiename1; // here it works > ?> > --- HTML code --- > <? > function one(){ > ?> > --- HTML code --- > <input name="domin" type="text" size="40" maxlength="63"> > --- HTML code --- > <? > } > function two(){ > $othervar=$_COOKIE['cookiename1']; > echo $othervar; // here it doesn't work > ?> > --- HTML code --- > <? > } > ?> > --- HTML code --- > > What am I doing wrong? Any tips? Any Ideas? > Thanks for help > > Peace & Love > skitum > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php