Radio Buttons --> PHP --> Email

[FONT=Arial][SIZE=2]Hello, this is a question based on the [/SIZE][/FONT][FONT=Arial]“Flash Based Email Form Using PHP” tutorial:

I’ve been able to get it to work when using text fields only (as in the tutorial), but I cannot get information from my radio buttons into the email generated by the php file. (I am using Flash 8)

Here’s the php code i’m using:

[/FONT]

<?php
$sendTo = "nycbmc@gmail.com";
$subject = "Lifetime Achievement Voting";

$vote = "I voted for: " .$_POST["vote"];// This is what I added
$headers = "From: " . $_POST["name"];
$headers .= "<" . $_POST["email"] . ">
";
$headers .= "Reply-To: " . $_POST["email"] . "
";
$headers .= "Return-Path: " . $_POST["email"];

mail($sendTo, $subject, $headers, $vote);
?>

[FONT=Arial]

the only AS associated with the form is:

on (release) {
form.loadVariables(“email.php”, “POST”);
}

for the submit button, and

[/FONT]

[FONT=Arial]onClipEvent(data){
_root.nextFrame();
}[/FONT]
[FONT=Arial]
[/FONT]
[FONT=Arial]for the mc that contains the form.

also, i’ve got five radio buttons that share the groupname “vote” and have individual values in the data field such as “trebek,” and “lincoln,” etc.

here’s a link to the file i’m working on: http://nycbeard.com/index_test.htm
(click on “vote for the lifetime achievement award link”)

thanks so much to anyone who can help out with this!!

[/FONT]

I won’t be any help if this turns out to be a flash issue, but just looking at your PHP code, your mail() function is wrong.

mail(string to, string subject, string message, string headers, string parameters) – where headers and parameters are optional.

You probably want to try changing your mail() line to:

mail($sendTo, $subject, $vote, $headers); // Change made here

thanks for you help. tried making that change in my mail() line, and got this:

I voted for: [object Object]

In the body of the email. Any ideas?

Well at least you’re getting the email now. :slight_smile:

Seems like you need to make sure that your script is sending the right radio button value to your PHP page. How to do that with ActionScript is beyond me. For all I know it may be like JavaScript where you have to loop through the radio buttons array until you find the index that has been selected. Then use the index of the selected radion button to find the value and pass the value.

Maybe someone with more Flash knowledge can help ya.