am creating a simple php login script and testing it in firefox before uploading the server but to my suprise it fails each time.
//index.php
<form name="form1" method="post" action="checklogin.php">
username<input name="myusername" type="text" id="myusername">
password<input name="mypassword" type="password" id="mypassword">
<input type="submit" name="Submit" value="Login">
</form>
//checklogin.php
<?php
// username and password sent from form
$myusername=$_POST['myusername'];
$mypassword=$_POST['mypassword'];
if($myusername==='stackoverflow')
{
if($mypassword==='stackoverflow')
{
session_register("myusername");
session_register("mypassword");
header("location:login_success.php");
}
}
else echo ("<h2>wrong username or password</h2><br><a href='index.php'>click here to try again</a>");
?>
when i drop the index.php script into firefox 4 and type username and password it always shows wrong username or password
. I thought this script was basic but it still eludes me. Please help.