0

hey im trying to make a file database but it just goes on and on a single line.question is: how do i make a new line after an entry is made?

<?php

$user=$_POST;
$pass=$_POST;

$file="fileone.txt";
$content= $user . ",";
file_put_contents($file,$content,FILE_APPEND);

$content2= $pass . "<br>";
echo nl2br(""); //??????
file_put_contents($file,$content2,FILE_APPEND);
?>

2
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by Borzoi
0

Would I be correct in assuming that the file is displaying the <br> where you want the line break? If so then use this instead:

<?php

  $user = $_POST['user'];
  $pass = $_POST['pass'];

  $file = "fileone.txt";
  $content = $user . ",";
  file_put_contents($file,$content,FILE_APPEND);

  $content2 = $pass . "\n";
  file_put_contents($file,$content2,FILE_APPEND);
?>

The \n basically means "new line" and should cause the desired line break. I could go into more detail about it if you wish.

This topic has been dead for over six months. 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.