Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-30-2006, 11:34 AM   PM User | #1
Max01
New Coder

 
Join Date: Nov 2006
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Max01 is an unknown quantity at this point
PHP froms - line breaks between body elements?

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.
Max01 is offline   Reply With Quote
Old 11-30-2006, 12:40 PM   PM User | #2
GJay
Senior Coder

 
Join Date: Sep 2005
Posts: 1,791
Thanks: 5
Thanked 36 Times in 35 Posts
GJay is on a distinguished road
\n is the character code for a linebreak, so you'd use:
PHP Code:
$body.=$_POST['blah']."\n"
GJay is offline   Reply With Quote
Old 11-30-2006, 04:13 PM   PM User | #3
Max01
New Coder

 
Join Date: Nov 2006
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Max01 is an unknown quantity at this point
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
Max01 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:09 PM.


Advertisement
Log in to turn off these ads.