Groups | Blog | Home
all groups > flash actionscript > june 2006 >

flash actionscript : Help with ActionScript/PHP email form


GanjaMasta
6/24/2006 9:58:56 PM
Hey guys, hope someone can help me out with this!

Haven't programmed in a while, but a friend asked me to look at this and
figure out why it isn't working. It's a simple form, with the text boxes
labeled inTxt_1, inTxt_2 ..... inTxt_13.

The ActionScript looks like this ...



Code:
submit.onRelease = function () {
var loadv = new LoadVars();
loadv._level0.mc1.inTxt_1 = _level0.mc1.inTxt_1.text;
loadv._level0.mc1.inTxt_2 = _level0.mc1.inTxt_2.text;
loadv._level0.mc1.inTxt_3 = _level0.mc1.inTxt_3.text;
loadv._level0.mc1.inTxt_4 = _level0.mc1.inTxt_4.text;
loadv._level0.mc1.inTxt_5 = _level0.mc1.inTxt_5.text;
loadv._level0.mc1.inTxt_6 = _level0.mc1.inTxt_6.text;
loadv._level0.mc1.inTxt_7 = _level0.mc1.inTxt_7.text;
loadv._level0.mc1.inTxt_8 = _level0.mc1.inTxt_8.text;
loadv._level0.mc1.inTxt_9 = _level0.mc1.inTxt_9.text;
loadv._level0.mc1.inTxt_10 = _level0.mc1.inTxt_10.text;
loadv._level0.mc1.inTxt_11 = _level0.mc1.inTxt_11.text;
loadv.send("email.php",loadv,"POST");
}

(Quick question ... why is the _level0.mc1 part needed? Or is it even
required?)

Here's the PHP ...


Code:

<?php
$To = "here@here.com";
$subject = "site reply";

$Name = $_POST["inTxt_1"];
$Email = $_POST["inTxt_2"];
$Company = $_POST["inTxt_3"];
$Position = $_POST["inTxt_4"];
$Address = $_POST["inTxt_5"];
$Address1 = $_POST["inTxt_6"];
$Address2 = $_POST["inTxt_7"];
$ZipCode = $_POST["inTxt_8"];
$Country = $_POST["inTxt_9"];
$Tel = $_POST["inTxt_10"];
$Enquiry = $_POST["enquiry"];
$Comments = $_POST["inTxt_11"];

\$headers = "From: " . $_POST["inTxt_1"]. "<" . $_POST["inTxt_2"] .">\r\n";
$headers .= "Reply-To: " . $_POST["inTxt_2"] . "\r\n";
$headers .= "Return-path: " . $_POST["inTxt_2"];

$message = "Name: $Name\n";
$message .= "Position: $Position\n";
$message .= "Company: $Company\n";
$message .= "Email: $Email\n";
$message .= "Address: $Address\n";
$message .= "Address1: $Address1\n";
$message .= "Address2: $Address2\n";
$message .= "Zip Code: $ZipCode\n";
$message .= "Country: $Country\n";
$message .= "Enquiry: $Enquiry\n";
$message .= "Phone: $Tel\n";
$message .= "Comments: $Comments\n";

mail($To, $subject, $message, $headers);
Print "Your mail has been sent";

?>

(Another question - why does the one $headers line have a / infront of it?
Should it be there?)

Now when I submit it, "Your mail has been sent" appears on the screen, but I
don't receive an e-mail. Can anyone help me?? Thanks so much!!

~Ganj

kglad
6/24/2006 10:32:11 PM
all those ladv._level0.mc1.whatever variables are incorrect. they should be:



for(var i=1;i<=11;i++){
loadv["inTxt_"+i]=_level0.mc1["inTxt_"+i].text;
kglad
6/24/2006 10:33:29 PM
AddThis Social Bookmark Button