Jump to content


Photo

How to get breaks in form email?


  • Please log in to reply
2 replies to this topic

#1 Dalbot

Dalbot
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 10 October 2006 - 09:44 PM

hi there! I need help. I have a php form, and it works. The problem is, I need it to have breaks < br > between the lines in the email that gets sent. Right now it comes in like this:

First Name: BobLast Name: DylanDaytime Phone Number: 111-222-3333Email Address: test@yahoo.comInterested Model: 4RunnerInterested Year: 2006Comments: This is a test.

I've tried adding < br > in the code but it's not working. Maybe I'm not placing them right.

How can I get line breaks?? Thanks!


<?php
require_once('mailclass.php');
$fname = trim($_POST['f1']);
$lname = trim($_POST['f2']);
$phone = trim($_POST['f3']);
$email = trim($_POST['f4']);
$vehicle = trim($_POST['f5']);
$year = trim($_POST['f6']);
$comments = trim($_POST['f7']);

$mymail = 'mail@xxxxxxxxxxx.com';
$from = 'mail@xxxxxxxxxxxx.com';

$subject = 'Contact';
$content .= 'First Name: '.$fname.'';
$content .= 'Last Name: '.$lname.'';
$content .= 'Daytime Phone Number: '.$phone.'';
$content .= 'Email Address: '.$email.'';
$content .= 'Interested Model: '.$vehicle.'';
$content .= 'Interested Year: '.$year.'';
$content .= 'Comments: '.$comments.'';
$mail = new email ( $subject, $content, "Dealersite.com", $from, $mymail);
$mail->send();
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL=thankyou.php">';
?>


#2 ronverdonk

ronverdonk
  • Members
  • PipPipPip
  • Advanced Member
  • 277 posts
  • LocationNetherlands

Posted 10 October 2006 - 09:53 PM

Use the newline char "\n" as the line break. Don't forget to put it between DOUBLE QUOTES.

Ronald  8)
RTFM is an almost extinct art form, it should be subsidized.

#3 Dalbot

Dalbot
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 10 October 2006 - 10:39 PM

Thank you good sir.  ;D




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users