Help with sample login codes.

Hello friends,
i have been studying php for sometime now & im finding the submission of my form a bit of a problem. When i click on submit button or refresh button, the else part of my if statement appears on screen.
What i want now is: for someone to PLEASE help me with sample php login codes that an "if...else" part appears ONLY when the user inputs a wrong ID and not when the page is refreshed or submit button clicked.
Thanks,
Golden Waters.
 
I suspect the problem might be in your form html code. Your <form> tag must include at least this:
<form action="yourpage.php" method="post">

and your form inputs must have a "name" attribute that matches your $_POST checking.
For example, if you are looking for $_POST("userid"), you must have <input type="text" name="userid" ....> somewhere in your html form before the </form> tag.

If you still can't figure it out, please send your PHP and form code.
 
This is my php code. All you said, i got right. I think the problem is with my php code. What do u think is wrong?

<?php
$name=$_post['myname'];
$pincode=$_post['pin'];
if($name=='myname'&&$pincode=='pin'){
echo "welcome";
}
else{
echo "invalid user";
}
?>

thanks,
golden waters.
 
Top