|
hi I'll give complete code just try it,
<?php
if(isset($_POST['posted']))
{
$name=$_POST['dir_username'];
$pass=$_POST['dir_password'];
$connect=mysql_connect('localhost','root','');
$db=mysql_select_db('dir_db',$connect);
$query=mysql_query('SELECT * FROM dir_login',$connect);
while($row=mysql_fetch_array($query))
{
$column1=$row['username'];
$column2=$row['password'];
if($column1 == $name && $column2 == $pass)
{
header('location:registration_dir.php');
}
else
{
echo('Sorry Username and password is mismatch');
exit();
}
}
}
?>
<form name="index_dir" method="post" action="index_dir.php">
<table align="center" border="">
<tr>
<td>
<b style="background-color:#063">USERNAME</b>
<input type="text" name="dir_username" value="USERNAME" style="background-color:#966">
</td>
</tr>
<tr>
<td><b style="background-color:#063">PASSWORD</b>
<input type="password" name="dir_password" value="*****" style="background-color:#966">
</td>
</tr>
<tr>
<td><input type="hidden" name="posted" value="true>"></td>
<td>
<input type="submit" name="dir_submir" value="GO" style="background-color:#063">
</td>
</tr>
</table>
</form>
just create adatabase and table using Mysql, and run it on localhost
|