jonkruse Posted December 21, 2007 Share Posted December 21, 2007 My background is a graphic designer and I am making a website in Flash and the client wanted to have a form that you fill out a request for a dvd. In flash I have some variables called "firstname", "lastname", "email", "address", "zip" When I click the button it sends me an email but I don't know how to format it in php so when I get the email the body looks like this: Name Address City, State, Zip email here is the php I'm using $sendTo = "[email protected]"; $subject = "3dGeneralist website comment"; $headers = "From: " . $_POST["firstName"] ." ". $_POST["lastname"] . "<" . $_POST["email"] .">\r\n"; $headers .= "Reply-To: " . $_POST["email"] . "\r\n"; $headers .= "Return-path: " . $_POST["email"]; $message = $_POST["message"]; mail($sendTo, $subject, $message, $headers); ?>[/tt] Link to comment https://forums.phpfreaks.com/topic/82662-basic-email-php/ Share on other sites More sharing options...
JJohnsenDK Posted December 21, 2007 Share Posted December 21, 2007 you should use html in the message variable: something like this: Name: <?=$_POST["firstName"];?> Adress: <?=$_POST["adress"];?> and so on and then put this in the headers: $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; Link to comment https://forums.phpfreaks.com/topic/82662-basic-email-php/#findComment-420435 Share on other sites More sharing options...
jonkruse Posted December 22, 2007 Author Share Posted December 22, 2007 $sendTo = "[email protected]"; $subject = "3dGeneralist DVD REQUEST"; $headers = "From: " . $_POST["firstName"] ." ". $_POST["lastname"] . "<" . $_POST["email"] .">\r\n"; $headers .= "Reply-To: " . $_POST["email"] . "\r\n"; $headers .= "Return-path: " . $_POST["email"]; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $message = Name: <?=$_POST["name"];?>; Address: <?=$_POST["address"];?> City: <?=$_POST["city"];?> State: <?=$_POST["state"];?> Zip: <?=$_POST["zip"];?> Country: <?=$_POST["zip"];?> Email: <?=$_POST["email"];?>; mail($sendTo, $subject, $message, $headers); ?> When I put this in it says: Address: City: State: Zip: Country: Email: ; // once the variables have been defined, they can be included // in the mail function call which will send you an email mail($sendTo, $subject, $message, $headers); ?> Sorry I'm a complete newb. Link to comment https://forums.phpfreaks.com/topic/82662-basic-email-php/#findComment-420952 Share on other sites More sharing options...
SirChick Posted December 22, 2007 Share Posted December 22, 2007 Have you got short tags turned on? Link to comment https://forums.phpfreaks.com/topic/82662-basic-email-php/#findComment-420953 Share on other sites More sharing options...
revraz Posted December 22, 2007 Share Posted December 22, 2007 This is all messed up $message = Name: <?=$_POST["name"];?>; Address: <?=$_POST["address"];?> City: <?=$_POST["city"];?> State: <?=$_POST["state"];?> Zip: <?=$_POST["zip"];?> Country: <?=$_POST["zip"];?> Email: <?=$_POST["email"];?>; If you're already in PHP, then there is no need to use <? again. You are using ; when you should use concatenations. Link to comment https://forums.phpfreaks.com/topic/82662-basic-email-php/#findComment-420955 Share on other sites More sharing options...
tbare Posted December 22, 2007 Share Posted December 22, 2007 don't forget your <br> tag after each line to go to the next line Link to comment https://forums.phpfreaks.com/topic/82662-basic-email-php/#findComment-420982 Share on other sites More sharing options...
Ninjakreborn Posted December 22, 2007 Share Posted December 22, 2007 1. Don't use short tags. 2. Clean it up some. Did the people above help fix your problems earlier, or are you still having some issues with it? Link to comment https://forums.phpfreaks.com/topic/82662-basic-email-php/#findComment-420984 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.