PDA

View Full Version : CheckBox Flash & PHP



Unit9
March 4th, 2005, 10:16 AM
Hi all, :)

I've created an email input form in Flash, with the fields 'name', 'email' and 'message', and I'm using this code on the submit button to send it via PHP:


on (release) {
// logical operator checks length. IndexOf checks for "@" and "." characters in e-mail
if (!name.length) {
results = "Enter your name.";

} else if (!email.length || email.indexOf("@") == -1 || email.indexOf(".") == -1) {
results = "Check your e-mail.";
} else if (!song.length) {
results = "Favorite song?";
} else if (!subject.length) {
results = "Title your comments.";
} else if (!message.length) {
results = "Enter your comments.";
} else {
loadVariablesNum ("form.php", 0, "POST");

}
}


And this code in the PHP:


<?php
$to = "Your Email";
$msg = "$name\n\n";
$msg .= "$message\n\n";

mail($to, $subject, $msg, "From: Contact at website <$email>");


$body2 = "If you want to use a confirmation email put it here.";

$subject2 = "Your Site - form submission confirmation ";
$header = "From: Whatever <you@blah.net>\r\n";

mail($email, $subject2, $body2, $header);

?>


Now I want to add a checkBox (which is part of Flash MXs components) and make it so if the checkbox isn't checked, then the email won't send.

I'm sure it's a simple thing to do, but, while I can post information from text fields, I have no idea what code to put on the submit button, or in the PHP file (I'm sure it's an 'IF' command though).

Can anybody help?

Thanks! :D