PHP:Why I get notice when running in Xampp server?
Notice:Undefined index:
Notice:Undefined index:
Administrator • Feb 27, 2013
Member • Feb 28, 2013
The_Big_K#-Link-Snipped-# - Two things -
1. Is that the full error message? Is there any detail included after Undefined index:.. ?
2. Possible for you to post the code so that experts here can dig deeper?
<?php
session_start();
include("connection.php");
ob_start();
$a=$_REQUEST['uname'];
$b=$_REQUEST['pwd'];
if(isset($_REQUEST['sub_login']))
{
$query="select * from register where uname='$a' and pwd='$b'";
$queryexe=mysql_query($query);
$count=mysql_num_rows($queryexe);
$row=mysql_fetch_array($queryexe);
$id=$row['user_id'];
$_SESSION['user_id']=$id;
if($count>0)
{
header("location:profile.php");
}
else
{
?><script>alert("Invalid Username/Password");</script><?php
}
}
?>
<script>
function validation()
{
if(document.login.uname.value=="")
{
alert("Please Enter Your Username")
document.login.uname.focus();
return false;
}
if(document.login.pwd.value=="")
{
alert("Please Enter Your Password")
document.login.pwd.focus();
return false;
}
}
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="https://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Login</title>
</head>
<body>
<form method="post" name="login" onSubmit="return validation();">
<table>
<tr>
<td>Username</td>
<td><input type="text" name= "uname" /></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" name= "pwd" /></td>
</tr>
<tr>
<td colspan="2"><center><input type="submit" name="sub_login" style="background: url(images/open.gif) no-repeat; width:120px; height:50px; text-indent: -1000em;cursor:pointer;border:none;"/></td>
</tr>
</table>
</form>
</body>
</html>
Administrator • Feb 28, 2013
Member • Feb 28, 2013
if(!empty($_REQUEST)){ }
Member • Mar 1, 2013
$a=@$_REQUEST['uname'];
$b=@$_REQUEST['pwd'];
Member • Mar 1, 2013
Member • Mar 1, 2013