html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Validation Page</title>
</head>
<body onload="document.validate.name.focus();">
<div align="center" id="validate">
<form action="validate.php" method="post" name="validate" runat="server" title="This a validation form" >
<table width="200" border="1">
<tr>
<th scope="row">User Name </th>
<td><label>
<input name="name" type="text" id="name" />
</label></td>
</tr>
<tr>
<th scope="row">Password</th>
<td><label>
<input name="psw" type="password" id="psw" />
</label></td>
</tr>
</table>
<p>
<label>
<input type="submit" name="Submit" value="Submit" />
</label>
</p>
</form>
</div>
<p>
<?php
$con = mysql_connect("localhost","root","meghlan")
or die("There was an error in the connection".mysql_error());
$db = mysql_select_db("manjunk",$con)
or die("there was an error while selecting the database".mysql_error());
//Here is the php code for the balidation form
$name = $_POST["name"];
$psw = $_POST["psw"];
echo "You entered : ".$name." and ".$psw."<br />";
$sql = "select * from user where user = '$name' ";
$result = mysql_query($sql,$con)
or die("<br /> There was an error in the query <br />".mysql_error());
while($row=mysql_fetch_array($result))
{
if($row==$user)
break;
}
if(!$row)
echo "No Access";
/*echo '<script type="text/javascript>
document.validate.name.focus();
</script>';*/
else
echo " Acces";
?>
</body>
</html>
i get no access ...whereas i hve another script almost identical to this which works fine..
please help..