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]");
?>

Recommended Answers

All 4 Replies

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.

commented: good +0

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

Member Avatar for rajarajan2017

Concetenate the statements like below with the single quotes.

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

It works perfect!

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

Thanks Its working

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.