hello all
I am very new to php and am having trouble adding the php script to my contact form.
I have a contact form made in swishmax2. this form was a tutorial and i have done that.
But as for the php script for the contact form, it was not explained how and where to add
script if i create new fields in the movie.
I have done this in Swishmax2 this code is for thew submit button. Now originally there was 4 fields
with this tutorial and i added 4 more but i am not sure where to add the extra php script for the new
fields.
this is the script in Swishmax2 for the submit button:
on (release) {
if((bridenameVar=="")||(brideemailVar=="")||(weddingdateVar=="")||(ceremonylocationVar=="")||(bridesaddressVar=="")||(cityVar=="")||(zipcodeVar=="")||(weddingdetailsVar=="")){
errormessage="Please fill out all the fields";
}
else {
errormessage="Sending....";
send="yes";
this.loadVariables("contact.php",'POST');
send="no";
bridenameVar="";//this was the nameVar//
brideemailVar="";//this was the emailVar//
weddingdateVar="";//this was the subjectVar//
ceremonylocationVar="";//new field added//
bridesaddressVar="";//new field added//
cityVar="";//new field added//
zipcodeVar="";//new field added//
weddingdetailsVar="";//this was the messageVar//
}
}
Now the original php script that came with the tutorial is this:
<?
if ($send=="yes") {
$to = "info@mafloral.com";//this is the email the message will be delivered to//
$subject = "$subjectVar";
$body .= "$msgVar";
$from = "$nameVar";
$tfrom = "From: <$emailVar>";
mail($to,$subjectVar,$msgVar,$tfrom);
}
echo "&errormessage=Email has been sent&";
?>
Could someone please help me with adding the script in the php
for the newly created fields.
Thanks in Advance
Bendeguz
php contact form
Moderator: General Moderators
Re: php contact form
Have you tried accessing them from the $_POST variable?
Code: Select all
<?
if ($_POST['send'] =="yes") {
$to = "info@mafloral.com";//this is the email the message will be delivered to//
$subject = $_POST['subjectVar'];
$body .= $_POST['msgVar'];
$from = $_POST['nameVar'];
$tfrom = "From: <" . $_POST['emailVar'] . ">";
mail($to,$subject,$body,$tfrom);
}
echo "&errormessage=Email has been sent&";
?>