I am using flash mx
I have a form, with a confirmation page that comes up when the user clicks on the submit button.
I want the user to also receive an email confirmation.
I have a php file someone gave me to use for this…
I am very new to flash and this is the first time I ever used php
my problem is, when the user clicks on the submit button, it calls the actual php file… so I know I have coded it wrong in flash…
can someone help me ?
here is my flash script;
globalStyleFormat.background = 0xCCFFFF;
globalStyleFormat.scrollTrack = “0xCCFFFF”;
globalStyleFormat.textSelected = 0xFF0000;
globalStyleFormat.applyChanges();
// push button callback
function onClick(btn) {
if (btn == submit_btn) {
getResults();
gotoAndStop(“pg2”);
} else if (btn == return_btn) {
gotoAndStop(“pg1”);
}
}
// get results from pg 1
function getResults() {
form_result = form_box.getValue();
list_result = list_box.getSelectedItem().label;
selectedItem = list_box.getSelectedIndex();
}
// initialize the values on pg 1 with the values the user has previously selected
function initValues() {
form_box.setValue(form_result);
if (!started) {
list_box.setSelectedIndex(0);
started = true;
} else {
list_box.setSelectedIndex(selectedItem);
}
}
initValues();
// push button callback
function onClick(btn) {
if (btn == submit_btn) {
getResults();
gotoAndStop(“pg2”);
{
getURL (“mail.php”, “_blank”, “POST”);
}
} else if (btn == return_btn) {
gotoAndStop("pg1");
}
}
// initialize the values on pg 1 with the values the user has previously selected
function initValues() {
form_box.setValue(form_result);
if (!started) {
list_box.setSelectedIndex(0);
started = true;
} else {
list_box.setSelectedIndex(selectedItem);
}
}
// get results from pg 1
function getResults() {
form_result = form_box.getValue();
list_result = list_box.getSelectedItem().label;
selectedItem = list_box.getSelectedIndex();
}
// reset button call
function onReset() {
name.text ="";
email.text ="";
list_box.setSelectedIndex(0);
form_box.setValue(true);
comments.text = “”;
}
here is my php file;
<?
/* subject */
$subject = “Contact form”;
/* additional header pieces for errors, From cc’s, bcc’s, etc */
$headers = "From: $name <$email>
";
$headers .= "X-Sender: <$email>
";
$headers .= "X-Mailer: PHP
"; // mailer
$headers .= "X-Priority: 1
"; // Urgent message!
$headers .= "Return-Path: $name_text <$email_text>
"; // Return path for errors
/* recipients */
$recipient = "iharper@sonic.net";
/* message */
$message = "A visitor to your website has sent this message to you from
your contact form:
"
."Name: “.$name_text.”
"
."E-Mail: “.$email_text.”
"
."Comments: “.$comments_text.”
“;
.“List:”.$list_result.”
";
/* and now mail it */
mail($recipient, $subject, $message, $headers);
$message2 = "Hello $name,
Your message has been received.
Thank you for your interest.
YourCompany Signature
";
$headers2 = “From: you <iharper@sonic.net>”;
// … more headers if you want them
mail($email, “confirmation”, $message2, $headers2);
?>
someone please help me… I am going nuts with this…