Am I loosing the plot or is something strange happening here?
I have a simple login form (see below), but when I call the page, PHP returns and undefined index error, even though I have coded to say if index is undefined, then die.
Am I missing something very obvious in PHP v 5
Form
<body>
<form method="post" action="">
<p align="center" class="style1">
<label>Username
<input type="text" name="username" />
</label>
</p>
<p align="center" class="style1">
<label>Password
<input type="password" name="password" />
</label>
</p>
<p align="center" class="style1">
<label>Remember me
<input type="checkbox" name="rememberme" />
</label>
</p>
<p align="center">
<input type="submit" name="login" value="Log in" />
</p>
</form>
</body>
Code:
if ($_POST['login']){
//get date
$username=$_POST['username'];
$password=$_POST['password'];
$rememberme=$_POST['rememberme'];
}else{
die("Please enter a valid username and password and click Submit");
}