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

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.

Thanks man.can i also put \r\n?

I believe so.

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.