Jump to content

Stupid email form question


harville85

Recommended Posts

I know this is probably so simple I'm going to cry after getting the answer, but I'll ask anyway: I can make a form on my website and it works great, sends the email over like it's supposed to, but how do I make it read like this:
Name: John Doe
Address: 123 st.
City: Doofus
State:XX
Instead of this:
John Doe
123 st.
Doofus
XX
I'm using PHP Mailer by the way. Any help would be appreciated!!!
Link to comment
Share on other sites

Thanks, I'll see if I can make this work. While I do that, here's an example of what I have now that works, but it doesn't list the actual category in my email.

$text_body = $_POST['contact_name']. "<br>";
$text_body .= $_POST['city']. "<br>";
$text_body .= $_POST['state']. "<br>";
$text_body .= $_POST['zip_code']. "<br>";
$text_body .= $_POST['phone']. "<br>";
$text_body .= $_POST['fax']. "<br>";
$text_body .= $_POST['email']. "<br>";
Link to comment
Share on other sites


Name: $text_body = $_POST['contact_name']. "<br>";
City: $text_body .= $_POST['city']. "<br>";
$text_body .= $_POST['state']. "<br>";
$text_body .= $_POST['zip_code']. "<br>";
$text_body .= $_POST['phone']. "<br>";
$text_body .= $_POST['fax']. "<br>";
$text_body .= $_POST['email']. "<br>";

i think you can do that mate!
Link to comment
Share on other sites

Sure, here it is:

<?

require("c:\php\includes\class.phpmailer.php");


$mail = new PHPMailer();


$mail->IsSMTP();

$mail->Host = "mail.harvilledesign.com";

$mail->SMTPAuth = true;

$mail->Username = "info@harvilledesign.com";

$mail->Password = "xxxxxx";


$mail->From =
$_POST['email'];

$mail->FromName = "HD Web Contact Form";


$mail->AddAddress("info@harvilledesign.com");
$mail->IsHTML(true);

$mail->Subject = "HD Web Contact Form";

$text_body = $_POST['contact_name']. "<br>";
$text_body .= $_POST['city']. "<br>";
$text_body .= $_POST['state']. "<br>";
$text_body .= $_POST['zip_code']. "<br>";
$text_body .= $_POST['phone']. "<br>";
$text_body .= $_POST['fax']. "<br>";
$text_body .= $_POST['email']. "<br>";

$mail->Body = $text_body;



if(!$mail->Send())
{
echo "There was an error sending the message";
exit;
}

header("Location:thankyou_hd.html");
?>
Link to comment
Share on other sites

[quote author=harville85 link=topic=103925.msg414219#msg414219 date=1155336416]
Thanks, I'll see if I can make this work. While I do that, here's an example of what I have now that works, but it doesn't list the actual category in my email.

$text_body = $_POST['contact_name']. "<br>";
$text_body .= $_POST['city']. "<br>";
$text_body .= $_POST['state']. "<br>";
$text_body .= $_POST['zip_code']. "<br>";
$text_body .= $_POST['phone']. "<br>";
$text_body .= $_POST['fax']. "<br>";
$text_body .= $_POST['email']. "<br>";
[/quote]change in[code]
$text_body = "Name: ".$_POST['contact_name']. "<br>";
$text_body .= "City: ".$_POST['city']. "<br>";
etc.
[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.