Dear All,
I am new to PHP and I was trying out following program which I got online.
<?php
if(isset($_Post['submit'])){
if($_Post['username']=="red" and $_Post['password']=="color"){
echo("you have logged in successfully");
}
else{
echo("error in login");
}
}
?>
<html>
<head></head>
<body>
<form method="post" action="login.php">
<lable>Username:</lable><input type="text" name="username"/>
<lable>Password:</lable><input type="text" name="password"/>
<input type="submit" name="submit" value="login">
</form>
</body>
</html>
But when i submit the form, it doesn’t ‘echo’ instead the form appears again.
What am i doing wrong here. I tried out many other programs with ‘form’ and results were same.
I am using PHP version 5.4.16. Output was same even when i was using PHP 5.3 version
Please let me know.
I am first time visitor of PHP sitepoint. Seems to be a great resource for learners.
Thank You,
Norma.