I'm working on a registration database. I am using flash as my applet, and talking to php to get everything out server side. Everything is working now, and my users are showing up in the database. Additionally, error messages pertaining to existing usernames or database errors come through fine. However, I am getting no confirmation on my side that registration was successul. Also, the fields do not clear, nor does the focus set. Here is my php section that applies to that, as well as the flash actionscript 2.0 that applies. Looks good to me, where am I wrong?
//if username already exists
if ($numrows > 0) {
$duplicate = 'Duplicate username. Please choose another.';
echo 'duplicate=y&message='.urlencode($duplicate);
}
else { //insert the data into the users data table
$sql = 'INSERT INTO Users (user, pwd, email, zipcode, country) VALUES ("'.$POST['username'].'","'.sha1($POST['pwd'].'","'.$POST['email'].'","'.$POST['zip'].'","'.$POST['country'].'")';
$result = $db->query($sql);
if ($result) {
$created = 'Account created for '.$POST['username'];
echo 'duplicate=n&message='.urlencode($created);
}
}
function showResult():Void{
if (this.error != undefined) {
//if the database class generates an error
error_txt.text = this.error;
//once error message has been displayed, unset showResult.error
this.error = undefined;
}else if (this.duplicate == "y") {
error_txt.text = this.message;
username_txt.text = "";
Selection.setFocus(username_txt);
}
else if(this.duplicate == "n") {
//displays any message from the php script and clears all fields
error_txt.text = this.message;
username_txt.text = "";
password_txt.text = "";
confPwd_txt.text = "";
zipcode_txt.text = "";
Selection.setFocus(firstname_txt);
}
}