Not a question I want to ask but I really need another pair of eyes on this one as it must be something silly I am missing.
I have used this same script previously so I’ve no idea what’s going wrong.
This is the frnt end code: http://jsfiddle.net/fU3Q3/1/
And the backend PHP is:
<?php
require("../db.php");
// get the posted values
$email=$_POST['email'];
$password=$_POST['password'];
// now validating the username and password
$sql="SELECT * FROM admin WHERE email='".$email."'";
$result=mysql_query($sql) or die ("No such username exists!");
$row=mysql_fetch_array($result);
// if username exists
if(mysql_num_rows($result)>0)
{
// compare the password
if(strcmp($row['password'],$password)==0)
{
echo "yes";
// set the session from here
$_SESSION['email']=$email;
}
else
echo "no";
}
else
echo "no"; // invalid Login
?>
Using firebug, the url that is sent to ajax-login.php seems to be email=&password=&rand=0.636999888626322 where obviously the bit on the end is the random number.
Any help is much appreciated.
Martin
you have 2 id’s of the same type, a div id of email, a input id of email for example, you can not call #email as it will stop at the first occurance
For further explanation… id’s without associated class names are considered unique, only 1 id can be used however if you have:
you can call these in jquery by using following examples:
formal declaration, type > classname ‘.’ > id ‘#’
and this will not work without matching the first tag