SESSION VARIABLES
| From: | Ronald Ramos | Date: | Tue, 10 Feb 2004 05:43:19 +0000 |
| Subject: | SESSION VARIABLES | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-177252@lists.php.net to get a copy of this message | ||
Hi All,
I've created 3 sample scripts, pls see below.
My problem is that page3.php can't display the value $username and
$password
Or is it because it the variables were not importe to that page, that's
why
$username and $password has no value? If it is, how can I import it?
Thank you
--------- login.php -------------
<html>
<body>
<form method="POST" action="auth.php">
<p>
USERNAME: <input type="text" name="uname" size="20"></p>
<p>PASSWORD: <input type="password" name="passwd"
size="20"></p>
<p><input type="submit" value="Login"
name="login"></p>
</form>
</body>
</html>
---------- auth.php -------------
<?php
$username = $_POST[uname];
$password = $_POST[passwd];
session_start();
if ($username == "ronald" AND $password == "ronald") {
session_register("username");
session_register("password");
echo"<html>
<head>
<script language=\"javascript\">
function bukas() {
window.open(\"page3.php\",\"_new\");
};
</script>
</head>
<body onload=\"bukas();\">
<p>$username
</body>
</html>";
}
else {
echo "INVALID, TRY AGAIN";
};
?>
--------------- page3.php --------------------------
<?php
echo "$username";
echo "#password";
?>