i gt this error in my login page : Undefined index: UserID in c:\program files\apache group\apache\htdocs\login.php on line 20 when i click the login button.
the below is my code:
<html>
<head>
<title>Login Here</title>
<h1>Login Here</h1>
<?php
session_start();
//$errorMessage = '';
if(isset($POST['UserID']) || isset($POST['Password'])){
//$errorMessage = 'Both id and password fields must be filled in.';
$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">
<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>
can anyone help me thanks