Hi Guys,
I have searched this forum and cant find an answer to why I keep receiving ‘undefined’ when receiving my loaded variables from a PHP page. I believe I am doing everything correct. For some reason it was working fine, then all of a sudden its not. It does work here and there but now it keeps saying undefined. Below is my code.
var senderLoad:LoadVars = new LoadVars();
var receiveLoad:LoadVars = new LoadVars();
onLogin.onRelease = function() {
senderLoad.uname = uname.text;
senderLoad.pword = pword.text;
senderLoad.sendAndLoad("login.php", receiveLoad, "POST");
};
receiveLoad.onLoad = function(ok:Boolean) {
pp.text = this.sentOK;
if (this.sentOK) {
gotoAndPlay("success");
} else {
gotoAndPlay("failed");
}
};
stop();
and here is the php code for reference;
include('conf.php');
$username = ltrim($_POST['uname']);
$password= md5(ltrim($_POST['pword']));
$check_user=mysql_query("SELECT * FROM stockists WHERE email='$username' AND password='$password'",$server);
$user_exists = mysql_num_rows($check_user);
if($user_exists)
{
$get_user=mysql_fetch_array($check_user);
$_SESSION['stockistID']=$get_user['ID'];
$_SESSION['admin']=1;
echo "&sentOK=1";
}
I seriously cant find an explanation to why it is doing this. Anyone??