Logic in flash for checking existing users in DB

Hi guys-
I have a php file checking my database for existing entries in the DB.
The PHP works fine. My flash logic however is somewhat off. I have never done this before, so some suggestions would be greatly appreciated. Here is the AS I have right now:


stop();
var dataOut:LoadVars = new LoadVars();
var dataIn:LoadVars = new LoadVars();
errortxt.autoSize = true;
dataIn.onLoad = function() {
    _global.responsetext = this.msgText;
    _global.errorIsTrue = true;
};
submit.onRelease = function() {
    _global.firstName = fname.text;
    _global.lastName = lname.text;
    _global.theEmail = email.text;
    dataOut.fnametxt = firstName;
    dataOut.lnametxt = lastName;
    dataOut.emailtxt = theEmail;
    dataOut.sendAndLoad("http://mm214.com/rswietek/authoring/post/checkuser.php", dataIn, "POST");
    if (fname.text == "" || lname.text == "" || email.text == "") {
        errortxt.text = "Please fill in all fields.";
    } else if (errorIsTrue == true) {
        errortxt.text = responsetext;
        trace("1");
    } else {
        _global.startTime = getTimer();
        _global.firstName = fname.text;
        _global.lastName = lname.text;
        _global.theEmail = email.text;
        trace("2");
        //_root.gotoAndStop(2);
    }
};

and if you need to see the php:


<?
$firstName = $_POST['fnametxt'];
$lastName = $_POST['lnametxt'];
$email = $_POST['emailtxt'];

$con = mysql_connect("localhost","uname","pw");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
 
$db = mysql_select_db("uname", $con);
if (!$db)
   {
   die('Could not connect: ' . mysql_error());
   }

  $query = "select * from assessment where fname = '$firstName' or lname = '$lastName ' or email = '$email' ";

  $result = mysql_query($query);

  $num_results = mysql_num_rows($result);
 
  if ($num_results > 0){

  echo "&msgText=Duplicate Entry.";
  }

?>

Thank you.