I have a flash page with a form and several variables I want emailed to me via PHP.
It all works except I receive variables in 2 different emails! The first has name, email etc variables, the second has answer variables from an animated questionnaire.
** How do I get all the variables from the page passing to email.php and sending to me in the 1 file? ** Any help is greatly appreciated.
- All the files are here: http://www.clickview.com.au/richard_dev/survey.zip
- A demo is here: http://www.clickview.com.au/richard_dev/survey_questions10.html
The Flash Code:
true_btn.onPress = function(){loadVariablesNum(“email.php”, 0, “POST”);
// This sends the % answers to email.php (value of 10 hardcoded for ‘maths_answer’ for testing)
form.loadVariables(“email.php”, “POST”);
// This sends the textfield answers (name, email, school)
If I comment out either line, I get the % or textfield answers mailing to me no problem.
With both lines at once though, email.php sends me 2 emails - one with %s and other with textfield answers (have to click submit twice though!).
Code for email.php:
<?php
$sendTo = "test@test.com";
$subject = “Survey Response”;
$headers = “From: " . $_POST[“name”] .” “. “<” . $_POST[“email”] .”>
";
$headers .= "Reply-To: " . $_POST[“email”] . "
";
$headers .= "Return-path: " . $_POST[“email”];
$message = "name is " . $_POST[“name”] . "
" . "email is " . $_POST[“email”] . "
" . "school is " . $_POST[“school”] . "
" . "maths answer is " . $_POST[“maths_answer”] . "
" . "science answer is " . $_POST[“science_answer”] . "
" . "english answer is " . $_POST[“english_answer”] . "
" . "humanities answer is " . $_POST[“humanities_answer”] . "
" . "health answer is " . $_POST[“health_answer”];
mail($sendTo, $subject, $message, $headers);
?>