make sure u run a session_start(); before anything on the page u cant access any session vars without it.
Joel "Terry Lau" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello, > I want to set a cookie when I enter a text into the text field, and it > shows the text I submitted immediately, thus I write a sample php code like > this: > > <?php > if (isset($HTTP_POST_VARS['Name'])) { > setcookie("name", $HTTP_POST_VARS['Name'], time()+86400*10); > } > echo $name; > ?> > (I set the text field is Name and the data will be sent to another page) > > In another page, I insert <?php echo $HTTP_COOKIE_VARS['name']; ?> in the > beginning of the code. > > Is the code right? > > Then I run the test, I enter a name into the text field and submit it. But > it shows "Notice: Undefined index: name in ..", it can't show the name I > submitted. > Why?Anything wrong?? > > Thanks!! > Terry > > > > > _________________________________________________________________ > 今日星座 http://www.msn.com.hk/fortune/west/ 運程 > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php