i have index.php
<form action="login.php" method="post">
<table width="249">
<tr>
<td>
<span class="style3">Username:</span> </td>
<td>
<input name="username" type="text" />
</td>
</tr>
<tr>
<td>
<span class="style3">Password: </span></td>
<td>
<input name="password" type="password" />
</td>
</tr>
<tr>
<td>
</td>
<td>
<input name="Login" type="submit" value="Login" />
</td>
</tr>
<tr>
<td colspan="2">
<div align="center" class="style3">Not a member yet?<br />
Please <a href="register.php">register!</a> </div></td>
</tr>
</table>
</form>
im new in php i have something to ask
what should i do in my login.php to be able to user to login there account.
heres my login.php please check if this is right code or not.
<?php
session_start();
include 'dbconnect.php';
$username = $_POST['username'];
$password = md5($_POST['password']);
$query = "select * from registered_members where username='$username' and password='$password'";
$result = mysql_query($query);
while ($row=mysql_fetch_array($result))
if ($row["password"]==$password )
{
$_SESSION['username'] = $row['$username'];
echo "Login Successful";
}
else
{
echo "bad login";
}
?>
i'm hoping that you can help me :)