This question already has an answer here:
- Undefined index in PHP post 3 answers
i tried a simple code for making a login...it works perfectly fine when i submit details..nd give correct reponse on the screen..but when I load it for first time on browser it displays an error message saying: Notice: Undefined index: usser in C:\wamp\www\test\first.php on line 14 and Notice: Undefined index: usser in C:\wamp\www\test\first.php on line 15 Can't identify the problem it has.
<html>
<head>
<title>My First PHP Program!</title>
<link type="text/css" rel="stylesheet" href="stylesheet.css"/>
</head>
<body>
<form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">
<p>username <input type="text" name="usser"/></p>
<p>password <input type="password" name="pass" /></p>
<p> <input type="submit" name="submit" /></p>
</form>
<?php
$name = $_REQUEST['usser'];
$pas=$_REQUEST['pass'];
if($name=="mandeep"&&$pas=="mani"){
echo "successful";
}
else{
echo "Login Failed";
}
?>
</body>
</html>
</div>