neonep
Programmer
- Jun 26, 2003
- 34
Hello everyone,
This is my first venture with php and I am trying to simulate a login screen.
This is what I have.
<?
if ( isset($_POST["login"]))
{
setcookie ( "loggedIn", $_POST["username"]);
}
?>
<html>
<body>
<form name="addForm" action="<? echo $_SERVER["PHP_SELF"]; ?>" method="post">
<input type="hidden" name="login">
Username: <input type="text" name="username" value="<? echo $_POST["username"]?>">
Password: <input type="password" name="passwd">
<a href="welcome.php">Click Here to LogIn"</a>
and so on
My problem is that once "Click here to Login" is clicked, welcome.php does come up but the cookie isn't set and I believe this is because the form hasn't been submitted. How do I make it so that the cookie is set and also it goes to the welcome page? Thanks.
This is my first venture with php and I am trying to simulate a login screen.
This is what I have.
<?
if ( isset($_POST["login"]))
{
setcookie ( "loggedIn", $_POST["username"]);
}
?>
<html>
<body>
<form name="addForm" action="<? echo $_SERVER["PHP_SELF"]; ?>" method="post">
<input type="hidden" name="login">
Username: <input type="text" name="username" value="<? echo $_POST["username"]?>">
Password: <input type="password" name="passwd">
<a href="welcome.php">Click Here to LogIn"</a>
and so on
My problem is that once "Click here to Login" is clicked, welcome.php does come up but the cookie isn't set and I believe this is because the form hasn't been submitted. How do I make it so that the cookie is set and also it goes to the welcome page? Thanks.