Problems with cookies and post variables
| From: | Kieran Hall | Date: | Tue, 06 Aug 2002 12:36:48 +0000 |
| Subject: | Problems with cookies and post variables | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-15140@lists.php.net to get a copy of this message | ||
I am running IIS 5 on win XP pro and am having a few problems passing
variables...
index.php
------------
<?PHP
if(IsSet($_COOKIE['login'])) {
print('<td class=tbl_info>Hello $_COOKIE['login'], you
are logged in</td>');
}
else {
print('
<form name=login action=http://localhost/bin/login.php
method=post>
<td>User: <input type=text name=user width=50> <input
name=submit type=submit value=Login!></td>
</form>
');
}
?>
------------
login.php
------------
<?PHP
setcookie('login', $_POST['user'], time()+3600);
header("Location: http://localhost/index.php");
?>
------------
The result is that the form remains, where I expected the hello message
to be. Does anyone know what the problem is likely to be?
Thanks in advance,
Kieran Hall.