0

unable to put new line in this code
i try "\n" , <br/>
but not working
i want that when this docoment write in the file data.txt there should be new line
between First name, last name and email

<?php
$file = fopen("data.txt", "a+");
fwrite($file,"First name:$_POST[fname] Last name:$_POST[lname] Email:$_POST[email] Comment:$_POST[comment]");
?>
4
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by xofth
1

Uhh don't you just hit the enter button?
And if you want them lined down on the actual web page that you are creating. You can just put <br> before the beginning of each line.

Votes + Comments
good
0

Concetenate the statements like below with the single quotes.

fwrite($fh, 'Look, Ma,'.chr(13).' I wrote a file! ')

It works perfect!

0

Try "\r\n" instead of just "\n" . \r is a carriage return.

Thanks Its working

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.