Page 1 of 1

Line breaks

Posted: Wed Sep 14, 2005 4:13 pm
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';
}

?>

Posted: Wed Sep 14, 2005 4:14 pm
by feyd
line break is: \n

and single quote strings will not parse string metacharacters (other than backslash).

Posted: Wed Sep 14, 2005 4:16 pm
by ryanlwh
also, when outputting to HTML "\n" does not produce line breaks in a browser. use <br>