Line breaks

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ethoemmes
Forum Commoner
Posts: 26
Joined: Thu Aug 18, 2005 4:11 pm

Line breaks

Post by ethoemmes »

Why does this code not insert line breaks after every echo statement?

TIA

Code: Select all

<?php
session_start();
header("Cache-control: private");

$Title = $_SESSION['Title'];
$FirstName = $_SESSION['FirstName'];
$LastName = $_SESSION['LastName'];
$Email = $_SESSION['Email'];

echo 'Please make sure you have entered all of the below fields. /n';

if (empty($Title)) {
echo 'Title /n';
}
if (empty($FirstName)) {
echo 'First Name /n';
}
if (empty($LastName)) {
echo 'Last Name /n';
}
if (empty($Email)) {
echo 'Email /n';
}

?>
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

line break is: \n

and single quote strings will not parse string metacharacters (other than backslash).
ryanlwh
Forum Commoner
Posts: 84
Joined: Wed Sep 14, 2005 1:29 pm

Post by ryanlwh »

also, when outputting to HTML "\n" does not produce line breaks in a browser. use <br>
Post Reply