i mean when i click the button login , there is no redirect of page or showing of errors, nothing happen.
the following is my code:
<html>
<head>
<title>Login Here</title>
<h1>Login Here</h1>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
function formReset()
{
var x=document.forms.myForm
x.reset()
}
</script>
<script type="text/javascript">
function CheckmyForm()
{
if (document.myForm.UserID.value == "")
{
alert("Please enter the User Id")
return false
}
else if (document.myForm.Password.value == "")
{
alert("please enter the password ")
return false
}
else {alert("Processing")}
}
</script>
<?php
session_start();
$errorMessage = '';
if(!isset($POST['UserID']) || !isset($POST['Password'])){
$errorMessage = 'Both id and password fields must be filled in.';
} else {
$myServer = "localhost";
$myUser = "sa";
$myPass = "";
$myDB = "SCSMembers";
$conn = mssql_connect('localhost', 'sa', '');
$blnresult = mssql_select_db('[SCSMembers]', $conn);
$UserID = $POST['UserID'];
$Password = $POST['Password'];
$sql = "SELECT * FROM AR01_MEMBER_ACCOUNT WHERE NRIC = '$UserID' AND Password = '$Password'";
$result = mssql_query($sql) or die('Query failed. ' . mssql_error());
if (mssql_num_rows($result) ==1) {
$_SESSION['db_is_logged_in'] = true;
echo "This is true and redirect";
header('Location: main.php');
} else {
$errorMessage = 'Sorry, wrong user id / password';
echo "wrong user / pass";
}
}
?>
<form method="post" name="myForm" action="login.php" onSubmit="return CheckmyForm()" enctype="multipart/form-data">
<table width="400" border="0" cellspacing="1" cellpadding="2">
<tr>
<td width="100">User ID:</td>
<td><input name="User ID" type="text" id="UserID"></td>
</tr>
<tr>
<td width="100">Password:</td>
<td><input name="Password" type="password" id="Password"></td>
</tr>
<tr>
<td width="100"> </td>
<td><input name="Login" type="submit" id="add" value="Login">
<input type="button" onclick="formReset()" value="Clear">
</td>
</tr>
</table>
</head>
</html>