Jump to content

Basic email php


jonkruse

Recommended Posts

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

$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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.