I have a little communication problem php -> flash.
I have a SWF with 2 text fields that I have appointed vlogin and vpassword and a button named loginbutton
I then send the information to the button with php script with this:
HTML Code:
loginButton.onRelease = function()
{
var a_send:LoadVars = new LoadVars();
var a_receive:LoadVars = new LoadVars();
a_receive.onLoad = function (success:Boolean)
{
if(success)
{
if (this.value == "bad" )
{
_root.gotoAndStop(3);//here the text field without a name with the variable value must show bad
}
else (this.value == "good" )
{
_root.gotoAndStop(2);//here the text field without a name with the variable value must display good
}
}
else
{
_root.gotoAndStop(4);// msg:error
}
};
a_send.login = vlogin.text;
a_send.password= vpassword.text;
a_send.sendAndLoad("script.php", a_receive, "POST" );
};
my php page (tested with an HTML form) sent me the good news
PHP Code:
<?php
include('connect.php');
if($_POST['login'])
{
$login = ($_POST['login']);
$password = ($_POST['password']);
$sql = "select password from pwmaj where login='".$login."'";
$req = mysql_query($sql) or die('Error SQL !<br>'.$sql.'<br>'.mysql_error());
$data= mysql_fetch_assoc($req);
if($data['password'] != $password)
{
echo "value=bad";
}
else
{
echo "value=good";
}
}
?>
The problem is that I didn't receive anything in flash and whatever happens good or bad login it pushes the return on the frame 2 that normally appears only if the return is "good" and its empty not good in the field ..
no news for movie clip:
Layer 1 img 1 field and button + script
Layer 2 & 3 img 2 & 3 return field with var: value
Layer 3 img 4 error message
Bookmarks