...

View Full Version : PHP froms - line breaks between body elements?



Max01
11-30-2006, 11:34 AM
Hello all,

Although basic, I seem to be struggling with laying out a PHP based web form. It executes to the desired inbox no problem; however, it’s not very legible as all the fields are bunched together without even a character break. The structure of the code is as follows:

<?php
$to = "enquiries@blahblahblah";
$subject = "Employer Registration Form";
$headers = "From: " . $_POST['emailAddress'];
$body = $_POST['contactPerson'];
$body .= $_POST['homePhone'];
$body .= $_POST['mobile'];
$body .= $_POST['fax'];
$body .= $_POST['bestTimeContact'];
$body .= $_POST['totalStaff'];
$body .= $_POST['kitchenStaff'];
$body .= $_POST['floorStaff'];
$body .= $_POST['staffTurnover'];
$body .= $_POST['comisChef'];
ini_set("sendmail_from", " enquiries@blahblahblah ");
mail($to,$subject,$body,$headers);
?>

How can I initiate a line break between each body element so as to make it easier to read once submitted?

Thanks in advance for any assistance.

GJay
11-30-2006, 12:40 PM
\n is the character code for a linebreak, so you'd use:


$body.=$_POST['blah']."\n";

Max01
11-30-2006, 04:13 PM
Excellent, thank you very much – didn’t expect such a timely response.

I hope to be of assistance myself sometime, though given my knowledge…….

Thanks



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum