Form is not responding

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.

Firstly, welcome to Sitepoint. Congratulations on learning more about PHP and this is the place to get answers to your questions.
There are a few things about your snippet that I see immediately.

In ALL software development spelling is important.

The $_POST variable should be all capital letters.
And, less important, ‘label’ is misspelled in your HTML.

Try those few changes and report your success or ask for more help.

Good luck.

By the way, please be sure to use the

 tag when pasting in snippets of code.

@Parkin T ; thank you for your quick reply. Will try out that.

Parkin thanks a lot… thank u so much.

I changed $_Post to $_POST and i got the result. I was stuck in this for a week.

Thank You.