New line not working in PHP?

  • Thread starter Thread starter robing
  • Start date Start date
R

robing

Guest
I am trying to present a dowloadable text file to a user that is dynamically crated based on user input. Unfortunaltly it seems to be ignoring the new lines. Here is my code:

<?php
header('Content-type: application/octet-stream');
header('Content-Disposition: attachment; filename="hello.txt"');
echo("Hello\n\nHow are you?\nIt is nice weather" . $_POST['text']);
?>

What I would like the output to be is:

Hello

How are you?
It is nice weather(USER INPUT)

But what I am getting is:

HelloHow are you?It is nice weather(USER INPUT)

Does anyone know why it is not creating a new line?
 
Back
Top