Hello!
All of my variables show up in my email just fine. 😉 The only other thing that I'm having trouble with is the validation. I can submit the form without filling it out. I placed an alert on my flash form and I can't seem to get the validation to work. Please help! 😕
Php code:
<?php
if(!empty($_POST['firstname'])
|| !empty($_POST['lastname'])
|| !empty($_POST['phone'])
|| !empty($_POST['email'])
|| !empty($_POST['eventType'])
|| !empty($_POST['hearCompany'])
|| !empty($_POST['calendar'])
|| !empty($_POST['clock'])
|| !empty($_POST['place'])
|| !empty($_POST['guests'])
|| !empty($_POST['budget'])
|| !empty($_POST['services'])
|| !empty($_POST['comm'])
|| !empty($_POST['other'])
|| !empty($_POST['others'])
{
// Every variable in a nice little array.
// Don't use name, message or state. These names are already defined in Actionscript. Be unique.
$data = array('firstname_txt' => $_POST['firstname'], 'lastname_txt' => $_POST['lastname'], 'phone_txt' => $_POST['phone'], 'email_txt' => $_POST['email'], 'eventType_cb' => $_POST['eventType'], 'company_cb' => $_POST['hearCompany'], 'calendar' => $_POST['calendar'], 'clock' => $_POST['clock'], 'place' => $_POST['place'], 'guests' => $_POST['guests'], 'budget_txt' => $_POST['budget'], 'services' => $_POST['services'], 'comm' => $_POST['comm'], 'other' => $_POST['other'], 'others' => $_POST['others']);
// Who should the email go to?
$to = "rgipson1@hotmail.com", "ebony@planningbyebony.com";
// What's the general subject?
$subject = "Event Planning By Ebony";
// To send HTML mail, the Content-type header must be set.
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers = 'From: ' . $data['firstname_txt'] . ' (' . $data['email_txt'] . ')' . "\r";
// Our final message:
$message = 'First Name:' . $data['firstname_txt'] . "\r\n";
$message .= 'Last Name:' . $data['lastname_txt'] . "\r\n";
$message .= 'Telephone:' . $data['phone_txt'] . "\r\n";
$message .= 'Email:' . $data['email_txt'] . "\r\n";
$message .= 'Type of Event:' . $data['eventType_cb'] . "\r\n";
$message .= 'How did you hear about the company?:' . $data['company_cb'] . "\r\n";
$message .= 'Date:' . $data['calendar'] . "\r\n";
$message .= 'Time:' . $data['clock'] . "\r\n";
$message .= 'Location:' . $data['place'] . "\r\n";
$message .= 'How many guests?:' . $data['guests'] . "\r\n";
$message .= 'Budget:' . $data['budget_txt'] . "\r\n";
$message .= 'Services Needed:' . $data['services'] . "\r\n";
$message .= 'Comments:' . $data['comm'] . "\r\n";
$message .= 'Other:' . $data['other'] . "\r\n";
$message .= 'Other:' . $data['others'] . "\r\n";
$message .= stripslashes($data['comm']) ."\r\n";
$message .= 'You can reply to this message by contacting ' . $data['firstname_txt'] . ' at: ' .$data['email_txt'] . "\r";
// Email that son of a gun!
if (@mail($to, $subject, $message, $headers))
{
echo "output=sent";
}else{
echo "output=error";
}
}
?>
AS2 Code:
sendLoad.sendAndLoad("sendMail.php",receiveLoad,"POST");
receiveLoad.onLoad = function(success:Boolean) {
if (success) {
gotoAndPlay(2);
}else if(receiveLoad.output=="error"){
Alert.show("The form is incomplete, please fill in the highlighted areas!", "Warning!");
}else{
}
Alert.show("There was a problem with the server. Please try again.", "Server Error");
}
}