<form action = "test.php" method="POST">
<input type = "text" name = "username">
<input type = "text" name = "password">
<input type = "submit" name = "submit" value="login">
</form>
Code (PHP)
include(connect.php);
$sql = "select * from user where username='".$_POST["username"]."' and password='".$_POST["password"]."' limit 1";
$rs = mysql_query($sql);
$num = mysql_num_rows($rs);
if($num != 0)
{
$_SESSION["login"] = "test";
}
else
{
echo "ไม่มี username หรือ password นี้";
}