PDA

View Full Version : Next Line



grandsp5
September 2nd, 2003, 02:00 PM
Ok so I have a working form that concatenates a bunch of variables together(thanks to digitalosophy and njs12345 for their help) My variable called $message ends up looking like this when I send it

Address: blah blah Name: blah blah Phone: blah blah

How do I put line breaks in between them so it looks like this

Address: blah blah
Name: blah blah
Phone: blah blah

if you need the php file itself, its in this forum under the title php parse error

Syntax
September 2nd, 2003, 02:12 PM
use the < br> tag or \n

grandsp5
September 2nd, 2003, 02:16 PM
Syntax,
Thank you but could you please be a little more specific? I am brand new to PHP. What would the formatting look like?



$message = "Name :".$name."\n" ;


is the line I have now. How would I change it?

PS - On a side not, what are the \n tags for?

Syntax
September 2nd, 2003, 02:20 PM
if the $message variable will be printed on screen with an echo (like echo $message;) in a web page you can use



$message = "Name :".$name."< br>";


use the < br> without the space betwen < and b

the \n adds a line break

grandsp5
September 2nd, 2003, 02:22 PM
hmm. Thats what I have now but for some reason it doesnt work.

Syntax
September 2nd, 2003, 02:22 PM
or try this:



$message= "Name:\t$name\nEmail:\t$email\nAddress:\t$address\n \n";

grandsp5
September 2nd, 2003, 02:27 PM
i got it to work with the br tags. Thanks for all of your help.

Syntax
September 2nd, 2003, 02:31 PM
no prob:)