cookie problem....
| From: | Terry Lau | Date: | Thu, 13 Feb 2003 08:07:09 +0000 |
| Subject: | cookie problem.... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-135395@lists.php.net to get a copy of this message | ||
Hello,
I created a PHP page that included cookie, here is the PHP code:
<?php
if (isset($HTTP_POST_VARS['Name'])) {
setcookie("Name", $HTTP_POST_VARS['Name'], time()+86400*10);
}
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=big5">
</head>
<body>
<form name="form1" method="post" action="request.php">
<p>Name: <input name="Name" type="text" id="Name">
</p>
<p>
<input type="submit" name="Submit" value="Submit">
</p>
</form>
</body>
</html>
But when I called the cookie variable in another page, it showed "Notice: Undefined index: Name in....". Here is the PHP code in another page:
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=big5">
</head>
<body>
HI!! <?php echo $HTTP_COOKIE_VARS['Name']; ?> </body>
</html>
Any problems in my PHP pages? How to solve it?
THANKS!!
Terry_________________________________________________________________ MSN 相簿提供您最簡單的方式分享並列印您的相片,請移至 : http://photos.msn.com.hk/support/worldwide.aspx