Yesterday, I had started a thread with a problem, am trying to execute the script below, but each time it is failing and returning "Unable to record form details".
Note: "Unable to record form details" is the response returned when isset($_POST) is not working, refer the code for more details.
That thread is solved and that part is still working, I followed the guidelines given therein, but the issue seems to be persisting.
The older thread:
http://www.daniweb.com/forums/thread312688.html
<form action="loggedIn.php" method="post" name="form">
<table class="TableLogin" style="cellpadding:4px; cellspacing:2px;">
<tr class="TableHeading">
<td colspan="2">Login Here</td>
</tr>
<tr class="FormContents">
<td>Username</td>
<td><input type="text" id="usrName" name="getName" size="20px" onkeyup="AJAX_Test(this.value)"/>
</td>
</tr>
<tr class="FormContents">
<td>Password</td>
<td><input type="password" id="pWord" name="getPass" size="20px"/></td>
</tr>
<tr class="FormContents">
<td></td>
<td align="right"><input type="submit" name="bt" id="lgSubmit" value="Login" onclick="loginCheck()"/></td>
</tr>
<tr class="FormContents">
<td align="center" colspan="2" id="lgLabel">Suggestions</td>
</tr>
</table>
</form>
<?php
if((isset($_POST['getName'])) && (isset($_POST['getPass'])))
{
$uName = $_POST["getName"];
$pWord = $_POST["getPass"];
$con = mysql_connect("","root","");
if(!$con)
{
die("Unable to connect to the SQL Server. ");
}
$sql_db = mysql_select_db("learn", $con);
if(!$sql_db)
{
die("Unable to select the database. ");
}
//Core Login Script
$sql="SELECT * FROM loginrecords WHERE username='$uName' and password='$pWord'";
$result = mysql_query($sql);
// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
// If result matched $uName and $pWord, table row must be 1 row
if($count==1)
{
// Register $uName, $pWord and redirect to file "login_success.php"
session_register("uName");
session_register("pWord");
header("location:loggedIn.php");
echo "Welcome " . $uName;
}
else
{
echo "Wrong Username or Password. <br/>";
}
}
else
{
$test=0;
die ("Unable to record form details. <br/>");
}
?>