Forums
This topic is locked
cookie problem in php_mysql...
15 Feb 2003 05:59:52 Terry Lau posted:
Hello,I set a cookie in a php page, here is the code:
<i><?php
if (isset($HTTP_POST_VARS['Name'])) {
setcookie("Name", $HTTP_POST_VARS['Name'], time()+86400*3);
}
?></i>
<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>
And in the request.php page, here is the code:
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=big5">
</head>
<body>
HI!! <i><?php echo $HTTP_COOKIE_VARS['Name']; ?> </i>
</body>
</html>
But when I run the page, it shows "HI!! Notice: Undefined index: Name in..."
What's the problem??The cookie doesn't work??How can I solve it?
THANKS!!!