I am trying to make messages show newline characters as the customer types it, but I am getting /r/n
between each line. I also want the $body .= $_SESSION['username'];
to appear on a separate line.
I have tried to use this example: PHP nl2br() basic function to solve, but have not been successful.
PHP:
$body .= $_SESSION['username'];
$body .= $message;
$to = $email;
$subject = "copy of your notification";
$headers = "From: noti@r.co.uk
";
$headers .= 'MIME-Version: 1.0' . "
";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "
";
$headers .= 'Bcc:noti@r.co.uk' . "
";
mail($to,$subject,$body,$headers);
HTML form:
<form action="notification.php" method="Post" class="rl">
<div>
<label for="message" class="fixedwidth">Message</label>
<textarea name="message" rows="7" cols="40" id="message"></textarea>
</div>
<div class="buttonarea">
<p>
<input type="submit" name="notify" value="Notify"></p>
</div>
</p>
</form>
You could try using the PHP_EOL
constant:
$body .= $_SESSION['username'].PHP_EOL;