hello
i am new to php and i find that this forum is giving out a very good support, so i hope those experts out there can help me with cookies. i've been figuring out the problem for the past 3 days but still can't find whats my problem. my source is given below
//main.html
<form method=post action='test2.php'>
LOGIN<input type=text name=user size=20><br>
PASSWORD<input type=text name=password size=20><br>
<input type=submit value=submit>
</form>
//test2.php
<?
require 'function.php';
deleteCookies();
if(!authenticateUser($user, $password) )
{
header("Location:http://$HTTP_HOST/$DOCROOT/display1.php");
}
else
{
setcookie('cookie_user', $user);
setcookie('cookie_password', $password);
header("Location:http://$HTTP_HOST/$DOCROOT/display2.php");
}
?>
//display2.php
<?
echo $cookie_user;
echo $cookie_password;
?>
//display3.php
<?
echo '$cookie_user';
echo '$cookie_password';
?>
if the authnticate is true display
$cookie_user$cookie_password
if the authentication is false it displays
Warning: Undefined variable: cookie_user in D:\PROJECT\testing\display2.php on line 2
Warning: Undefined variable: cookie_password in D:\PROJECT\testing\display2.php on line 3
what i know is that once we set a cookie, the cookie can be access anywhere until the browser is close but why does the display2.php and display3.php doesn't displya the values of the cookies_user and cookie_password.
thanks