sk8rjess
03-05-2008, 05:27 PM
i've got a contact form done in flash. for it to select who to send the message to, the users have to use a radio button to select the different email(sales, services, ect)
i cant seem to get it to work. i snagged code for the radio buttons off a voter.
heres the flash actionscript: the radio buttons n
var loadVars_in:LoadVars = new LoadVars();
var loadVars_out:LoadVars = new LoadVars();
listenerObject = new Object();
listenerObject.click = function(eventObject) {
_parent.true_btn.enabled = true;
};
radioGroup.addEventListener("click", listenerObject);
//Vote
_parent.true_btn.onRelease = function() {
var selectedNum:Number = radioGroup.selectedData;
_parent.loadVars_out.choice = selectedNum;
loadVars_out.choice = selectedNum;
trace (selectedNum);
}
all the radio buttons have a data of numbers. ex, the first radio btn is "1" and the second is "2"
heres the php:
<?php
/************************************************** *\
* PHP 4.1.0+ version of email script. For more
* information on the mail() function for PHP, see
* http://www.php.net/manual/en/function.mail.php
\************************************************* **/
$choice =$_POST['choice'];
if($choice == 1){
$sendTo="my@email.com";
}
if($choice == 2){
$sendTo="my.other@email.com";
}
$subject = "Reply";
$headers = "From: " . $_POST["firstName"] ." ". $_POST["lastname"] . "<" . $_POST["email"] .">\r\n";
$headers .= "Reply-To: " . $_POST["email"] . "\r\n";
$headers .= "Return-path: " . $_POST["email"];
$message = "Name: " . $_POST["name"] . "\n" . "Address: " . $_POST["address"] . "\n" . "City, State, Zip: " . $_POST["citystatezip"] . "Phone: " . $_POST["phone"] . "\n" . "Email: " . $_POST["email"] . "\n". "Message" . $_POST["message"];
mail($sendTo, $subject, $message, $headers);
?>
oh, and all the form related things are inside a movie clip called "form"
i cant seem to get it to work. i snagged code for the radio buttons off a voter.
heres the flash actionscript: the radio buttons n
var loadVars_in:LoadVars = new LoadVars();
var loadVars_out:LoadVars = new LoadVars();
listenerObject = new Object();
listenerObject.click = function(eventObject) {
_parent.true_btn.enabled = true;
};
radioGroup.addEventListener("click", listenerObject);
//Vote
_parent.true_btn.onRelease = function() {
var selectedNum:Number = radioGroup.selectedData;
_parent.loadVars_out.choice = selectedNum;
loadVars_out.choice = selectedNum;
trace (selectedNum);
}
all the radio buttons have a data of numbers. ex, the first radio btn is "1" and the second is "2"
heres the php:
<?php
/************************************************** *\
* PHP 4.1.0+ version of email script. For more
* information on the mail() function for PHP, see
* http://www.php.net/manual/en/function.mail.php
\************************************************* **/
$choice =$_POST['choice'];
if($choice == 1){
$sendTo="my@email.com";
}
if($choice == 2){
$sendTo="my.other@email.com";
}
$subject = "Reply";
$headers = "From: " . $_POST["firstName"] ." ". $_POST["lastname"] . "<" . $_POST["email"] .">\r\n";
$headers .= "Reply-To: " . $_POST["email"] . "\r\n";
$headers .= "Return-path: " . $_POST["email"];
$message = "Name: " . $_POST["name"] . "\n" . "Address: " . $_POST["address"] . "\n" . "City, State, Zip: " . $_POST["citystatezip"] . "Phone: " . $_POST["phone"] . "\n" . "Email: " . $_POST["email"] . "\n". "Message" . $_POST["message"];
mail($sendTo, $subject, $message, $headers);
?>
oh, and all the form related things are inside a movie clip called "form"