I'm trying to use the if statement in flash to check if a variable (fetched from PHP) is equal to something, but something is going wrong.
The code:
function completeHandler(event:Event):void{
// Load the response from the PHP file
var data:URLVariables = new URLVariables(event.target.data);
var return_stat = data.return_stat_verify;
if (return_stat == "FAILED"){
status_txt.text = "dsfdsfg";
}
else if (return_stat == "PASSED"){
var first_nme = data.return_first;
var second_nme = data.return_second;
var email_addr = data.return_email;
var user_domain = data.return_domain;
var user_name = data.return_username;
gotoAndPlay("finish");
first_txt.text = first_nme;
second_txt.text = second_nme;
email_txt.text = email_addr;
username_txt.text = user_name;
domain_txt.text = user_domain;
}
Now when i test that, nothing happens. I then make an attempt to place a simple else
statement in there to see if both if
and else if
statements fail.
the code:
function completeHandler(event:Event):void{
// Load the response from the PHP file
var data:URLVariables = new URLVariables(event.target.data);
var return_stat = data.return_stat_verify;
if (return_stat == "FAILED"){
status_txt.text = "dsfdsfg";
}
else if (return_stat == "PASSED"){
var first_nme = data.return_first;
var second_nme = data.return_second;
var email_addr = data.return_email;
var user_domain = data.return_domain;
var user_name = data.return_username;
gotoAndPlay("finish");
first_txt.text = first_nme;
second_txt.text = second_nme;
email_txt.text = email_addr;
username_txt.text = user_name;
domain_txt.text = user_domain;
}
else {
status_txt.text = "I hate flash";
}
Now when i test that, flash prints out "I hate flash" in the status_txt
field. So i then replace the value of status_txt
to print out the variable that I'm using the if statements with (return_stat
):
else {
status_txt.text = return_stat;
}
Then when i test it, it shows either PASSED or FAILED. Which means the issue does not lie in PHP as it's returning the correct data and the issue lies within the If
statements.
I'm completely lost here. I don't see anything that I've done wrong, any ideas?
Thanks guys.
EDIT
My PHP CODE:
<?php
require ('installation_5_functions.php');
require ('cust_ver_i.php');
$username=$_POST['userName'];
$ident_encrypt=$_POST['userPsswrd'];
verify($reference_id, $username, $ident_encrypt);
if ($ref_id_stat == "FAILED"){
$retrn_stat = "FAILED";
print "return_value=$error_ref_id&return_stat_verify=$retrn_stat";
exit();
}
if($ref_id_stat == "PASSED"){
if ($user_verify_status == "FAILED"){
$retrn_stat = "FAILED";
print "return_value=$user_verify_error&return_stat_verify=$retrn_stat";
}
elseif ($user_verify_status == "PASSED"){
if ($cust_status == "DEACT"){
$retrn_stat = "FAILED";
print "return_value=$display_error_stat&return_stat_verify=$retrn_stat";
}
elseif ($cust_status == "ACTIVE"){
$retrn_stat = "PASSED";
print "return_first=$cust_first&return_second=$cust_last&return_email=$cust_email&return_username=$cust_username&return_domain=$cust_domain&return_stat_verify=$retrn_stat";
}
}
}
?>