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'];