PHP-Flash Log in Form. Returned Value is wrong. Please help

Login Form: I send Login and Password from Flash to PHP. PHP accepts those values, checks them against the database, and then… returns something weird to flash. Instead of just returning “true” (if the password is correct) or “false” (if the password in not correct), [COLOR=“Red”]PHP returns one of those values AND whatever comes after that value, including even the closing PHP tag ?>[/COLOR] … I know it because I trace the returned value in Flash. I need your help with my scripts.

This is my Flash button, sending the values to PHP.


submitButton.onPress = function() {
	if (userName.text != "" or password.text != "") {
		whatToDo = "reLogin";
		reLoginName = userName.text;
		reLoginPassword = password.text;
		loadVariablesNum("login.php",0,"POST");
		gotoAndPlay("slide");
	}
};

This is my PHP script, accepting the values, checking them against the DB, and sending them back to flash.


<?php 

include("db.php");
loginInfo(); //calls the function inside of db.php

$table = 'memberslogin';
$whatToDo =  $_POST["whatToDo"]; //variable posted from the Flash file
	
 if ($whatToDo == "reLogin") {
	  mysql_pconnect($host, $user, $pass) or die("connection failed");
	  mysql_select_db($database) or die("db selection failed");
	  $reLoginName = $_POST["reLoginName"];//variable posted from the Flash file
	  $reLoginPassword = md5($_POST["reLoginPassword"]);//variable posted from the Flash file
	  $query = "SELECT password FROM $table WHERE loginName = '$reLoginName' ";
	  $result = mysql_query($query);
	  $row = mysql_fetch_array($result);
	   if ($reLoginPassword == $row["password"]) {
	      echo "&loggedIn=true";
	   } else {
	  echo "&loggedIn=false";
	}
}
	
?>

This is my Flash script that accepts the returned value and acts accordingly.


if (loggedIn == undefined) {
	gotoAndPlay("wait");
}
if (loggedIn == "true") {
	gotoAndStop("success");
}
if (loggedIn == "false") {
	gotoAndStop(1);
}else {
            gotoAndStop(8);
            trace(loggedIn); //THIS IS WHERE I can see that the returned value is not "true", not "false", not "undefined".
}

Any help is GREATLY appreciated.