PHP email form, for Flash website

Hey,
I am new to PHP, and i have been reading up on it a little, but I seem to be having some trouble. In a flash website im making i created a form from a template i found. The original template had E-mail, Name, Comment fields, and the PHP code is as follow,

<?
 
$destination="[email protected]";
$name=$_POST['name'];
$email=$_POST['email'];
$mes=$_POST['comments'];
$subject="Message from $name" ;
$mes="Name : $namen
Email: $emailn
Comments: $mesn";
mail($destination,$subject,$mes); ?>

In the flash video, i added a few fields, Street Address, City, State, Zip, Favorite Designers, and i reformated the code to this, but now it doesnt work at all. If anyone can assist me in what i am doing wrong, i would be greatly happy.

<?
 
$destination="[email protected]";
$name=$_POST['name'];
$email=$_POST['email'];
$mes=$_POST['street'];
$mes=$_POST['city'];
$mes=$_POST['state'];
$mes=$_POST['zip'];
$mes=$_POST['designer'];
$mes=$_POST['comments'];
$subject="LINK WEBSITE Form, From $name" ;
$mes="Name : $namen
Email: $emailn
Street Address: $streetn";
City/Town: $cityn";
State: $staten";
Zip: $zipn";
Favorite Designers: $designern";
Comments: $mesn";
mail($destination,$subject,$mes); ?>

To answer me own question, if anyone ever had the same problem, i didnt change the variables, and i re used ending strings on all the lines. the working code is,

$destination="[email protected]"; $name=$_POST['name']; $email=$_POST['email']; $street=$_POST['street']; $city=$_POST['city']; $state=$_POST['state']; $zip=$_POST['zip']; $designer=$_POST['designer']; $comments=$_POST['comments']; $subject="LINK WEBSITE Form, From $name" ; $mes="Name : $namen Email: $emailn Street Address: $streetn City/Town: $cityn State: $staten Zip: $zipn Favorite Designers: $designern Comments: $commentsn"; mail($destination,$subject,$mes); ?>

Yes I noticed that on the non-working code, you had closing quotes and semi - colons on lines where they weren’t needed.

Glad you got it working.

Sponsor our Newsletter | Privacy Policy | Terms of Service