I'm very unfamiliar with PHP...
<?php
$myfile = fopen("emaillist.txt", "w");
$newemail = "email1\n";
fwrite($myfile, $newemail);
$newemail = "email2\n";
fwrite($myfile, $newemail);
fclose($myfile);
?>
The code is to create a database of emails. When going to emaillist.txt, the output is:
email1
email2
The output will stay like that, even if I run the php file a new line. My desired output is to for example run it twice, and get:
email1
email2
email1
email2
I'm aware storing emails in .txt files isn't smart, but this isn't for real world use.
It turns out I had to do fopen("emaillist.txt", "a");instead of fopen("emaillist.txt", "w");because a appends to the file, while w just writes to it.