onload function don’t work properly,it didn’t return anything after the php files is executed and the data is inserted into mysql databases.why?
here is my source:
action script
var userData=new LoadVars();
submit.onRelease=function(){
userData.username=username.text;
userData.password=password.text;
userData.email=email.text;
userData.comments=comments.text;
userData.sendAndLoad(“http://localhost/nick/register2.php",userData,"POST”);
}
userData.onLoad=function(){
if(userData.register==“ture”){
gotoAndPlay(“success”);
}else{
gotoAndPlay(“fail”);
}
}
php
<?php
$username=$HTTP_POST_VARS[“username”];
$password=$HTTP_POST_VARS[“password”];
$email=$HTTP_POST_VARS[“email”];
$comments=$HTTP_POST_VARS[‘comments’];
$conn=mysql_connect(‘localhost’,‘root’,‘’) or die(mysql_error());
$db=mysql_select_db(‘test’,$conn) or die(mysql_error());
$result=mysql_query(“INSERT INTO nick(username,password,email,comments)values(‘$username’,‘$password’,‘$email’,‘$comments’)”) or die(mysql_error());
if($result)
{
echo “register=ture”;
}else{
echo “register=fail”;
mysql_close($conn);
}
?>