i want to save every username in newline
i want text file to look like this :
<?php $username = "\n".$_POST['username']; file_put_contents("users.txt",$username, FILE_APPEND); ?>
since you seemingly write at the end of the existing file, you have to prepend a linebreak to it.
on a side note: you should always be very careful when processing unfiltered user data.