New Line in PHP

Banned
14Jul2009,10:03   #1
naimish's Avatar
Please see the code below first.

Code:
 
<?php
$savedata = $_REQUEST['savefeedback'];
if ($savefeedback == 1){ 
$data = $_POST['name'];
$data .= $_POST['feedback'];
$file = "feedback.txt"; 
$fp = fopen($file, "a") or die("Couldn't open $file for writing!");
fwrite($fp, $data) or die("Couldn't write values to file!"); 
fclose($fp); 
echo "Your Form has been Submitted!";
}
?>
Output :

NaimishYour Website is very nice.
JohnI will visit your website now.

Now What I want to do is, the output should be like this,

Naimish
Your Website is very nice.

John
I Will visit your website now.

How can I apply code for a new line in below code ?

Code:
 
 
$data = $_POST['name'];
$data .= $_POST['feedback'];
Go4Expert Founder
14Jul2009,10:12   #2
shabbir's Avatar
Use <br /> if you use an HTML output
Banned
14Jul2009,10:31   #3
naimish's Avatar
Code:
<html dir="ltr">
    <head>
        <title></title>
        <?php
$name = $_POST['name'];
$email .= $_POST['email'];

$count = $email."/n".$name."/n";

$file = fopen("YOURDATAFILE.txt", "a");
fputs($file, "$name $email");
fclose($file);
?>
    </head>
    <body>
    </body>
</html>
Nothing working
Banned
14Jul2009,10:32   #4
naimish's Avatar
Code:
fputs($file, "$name $email");
What needs to put in between $name and $email to get $email printed on next line ?
Go4Expert Founder
14Jul2009,10:34   #5
shabbir's Avatar
Quote:
Originally Posted by naimish View Post
Code:
fputs($file, "$name $email");
What needs to put in between $name and $email to get $email printed on next line ?
<br />
Banned
14Jul2009,10:40   #6
naimish's Avatar
Code:
<br />
Thanks a lot Shabbir, I got it done through it.
Go4Expert Member
6Aug2009,17:10   #7
msn90's Avatar
Thanks for this post. it is very helpful.
Banned
6Aug2009,22:50   #8
Seema786's Avatar
stranger that <br /> is working in php too.
Banned
7Aug2009,20:47   #9
Saket's Avatar
yeah we can use <br/> in php. just like html
Team Leader
8Aug2009,12:21   #10
pradeep's Avatar
You may also use this very handy PHP function nl2br http://us3.php.net/manual/en/function.nl2br.php