A Tip on PHP forms in Flash

Hi All,

After a tough week trying to figure out why my PHP form wasn’t working inside a nested movie clip (and with a lot of help from junkerjorg)…Here’s a tip…

1/ Make sure what version of PHP is running on your server…This is critical because you need to use whatever extension the server wants… such as .php4 or just .php etc.

and

2/ Don’t name any of the fields in your flash form “message”…PHP seems to get very confused…Call the field ‘comments’ or something similar.

Here is a basic php script that has worked over and over. It has 3 fields
Name
Email
Subject
Comments

<?PHP
$to = "[email protected]";

$msg .= "Attention: Your Company Web Site Contact.

";
$msg .= "Name: " . $HTTP_POST_VARS[“name”] . "
";
$msg .= "Email: " . $HTTP_POST_VARS[“email”] . "
";
$msg .= "Subject: " . $HTTP_POST_VARS[“subject”] . "
";
$msg .= "Comments: " . $HTTP_POST_VARS[“comments”] . "
";
mail($to, $HTTP_POST_VARS[“name”], $msg, "From Your Company Group Web Site.
Reply-To: ". $HTTP_POST_VARS[“email”] . "
");

Print “status=Information sent.”;
?>

[COLOR=Red]And here is the submit button action script:[/COLOR]

on (press) {
if (name eq “” or email eq “” or subject eq “” or comments eq “”) {
stop();
} else {
loadVariablesNum(“yourscript’sname.php”, 0, “POST”) ;
_root.gotoAndStop(5); [COLOR=Red](if you want it this is a “Your message has been sent” frame…if not delete this line)[/COLOR]

}
}

Anyhow I hope this helps someone out there…Kudos to Kirupa!!
Mick