By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,747 Members | 2,039 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,747 IT Pros & Developers. It's quick & easy.

PHP Flash form help

P: 2
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,

Expand|Select|Wrap|Line Numbers
  1.  
  2. <?
  3.  
  4. $destination="mjweitz@gmail.com";
  5. $name=$_POST['name'];
  6. $email=$_POST['email'];
  7. $mes=$_POST['comments'];
  8. $subject="Message from $name" ;
  9. $mes="Name : $name\n
  10. Email: $email\n
  11. Comments: $mes\n";
  12. mail($destination,$subject,$mes); ?>
  13.  
  14.  

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.

Expand|Select|Wrap|Line Numbers
  1.  
  2. <?
  3.  
  4. $destination="mjweitz@gmail.com";
  5. $name=$_POST['name'];
  6. $email=$_POST['email'];
  7. $mes=$_POST['street'];
  8. $mes=$_POST['city'];
  9. $mes=$_POST['state'];
  10. $mes=$_POST['zip'];
  11. $mes=$_POST['designer'];
  12. $mes=$_POST['comments'];
  13. $subject="LINK WEBSITE Form, From $name" ;
  14. $mes="Name : $name\n
  15. Email: $email\n
  16. Street Address: $street\n";
  17. City/Town: $city\n";
  18. State: $state\n";
  19. Zip: $zip\n";
  20. Favorite Designers: $designer\n";
  21. Comments: $mes\n";
  22. mail($destination,$subject,$mes); ?>
  23.  
  24.  
Feb 28 '08 #1
Share this Question
Share on Google+
3 Replies


Markus
Expert 5K+
P: 6,050
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,

Expand|Select|Wrap|Line Numbers
  1.  
  2. <?
  3.  
  4. $destination="mjweitz@gmail.com";
  5. $name=$_POST['name'];
  6. $email=$_POST['email'];
  7. $mes=$_POST['comments'];
  8. $subject="Message from $name" ;
  9. $mes="Name : $name\n
  10. Email: $email\n
  11. Comments: $mes\n";
  12. mail($destination,$subject,$mes); ?>
  13.  
  14.  

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.

Expand|Select|Wrap|Line Numbers
  1.  
  2. <?
  3.  
  4. $destination="mjweitz@gmail.com";
  5. $name=$_POST['name'];
  6. $email=$_POST['email'];
  7. $mes=$_POST['street'];
  8. $mes=$_POST['city'];
  9. $mes=$_POST['state'];
  10. $mes=$_POST['zip'];
  11. $mes=$_POST['designer'];
  12. $mes=$_POST['comments'];
  13. $subject="LINK WEBSITE Form, From $name" ;
  14. $mes="Name : $name\n
  15. Email: $email\n
  16. Street Address: $street\n";
  17. City/Town: $city\n";
  18. State: $state\n";
  19. Zip: $zip\n";
  20. Favorite Designers: $designer\n";
  21. Comments: $mes\n";
  22. mail($destination,$subject,$mes); ?>
  23.  
  24.  
[php]
$destination="mjweitz@gmail.com";
$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 : $name\n
Email: $email\n
Street Address: $street\n
City/Town: $city\n
State: $state\n
Zip: $zip\n
Favorite Designers: $designer\n
Comments: $mes\n";
mail($destination,$subject,$mes); ?>
[/php]

Notice the quotes and semicolons i took out.
They are used to end strings... you were ending strings that hadnt even started :P
Feb 28 '08 #2

TheServant
Expert 100+
P: 1,168
[php]
$destination="mjweitz@gmail.com";
$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 : $name\n
Email: $email\n
Street Address: $street\n
City/Town: $city\n
State: $state\n
Zip: $zip\n
Favorite Designers: $designer\n
Comments: $mes\n";
mail($destination,$subject,$mes); ?>
[/php]

Notice the quotes and semicolons i took out.
They are used to end strings... you were ending strings that hadnt even started :P
I don't understand why you are changing the $mes variable? Shouldn't it be:
[php]
$destination="mjweitz@gmail.com";
$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 : $name\n
Email: $email\n
Street Address: $street\n
City/Town: $city\n
State: $state\n
Zip: $zip\n
Favorite Designers: $designer\n
Comments: $comments\n";
mail($destination,$subject,$mes); ?>
[/php]
Feb 28 '08 #3

P: 2
Now that i see it, its so obvious. I guess looking at the same thign over and over, you tend to ove rlook the minor mistakes. Thank you guys very much for your help.
Back to the books!
Feb 29 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.