Store multiple submissions in txt file

hello i have setup a file to allow people to submit minecraft alts to my site for me to put into the generator. The problem is that whenever a new entry is made it deletes old entrys. It also displays entrys 2x. the code is

<?php $file = fopen("collections/mc.txt", "w") or die("Unable to open file!"); if (isset($_POST['nfa'])) { $type = "nfa"; } if (isset ($_POST['sfa'])) { $type = "sfa"; } if (isset ($_POST['ufa'])) { $type = "ufa"; } if (isset ($_POST['unknown'])) { $type = "unknown"; } $username = $_POST['email']; $password = $_POST['password']; $mailurl = $_POST['accessurl']; $mailpassword= $_POST['accesspassword']; $details = " ================================== type: $type email: $username password: $password mail url: $mailurl mail password: $mailpassword ================================== "; fwrite($file, $details); $details = " ================================== type: $type email: $username password: $password mail url: $mailurl mail password: $mailpassword ================================== "; fwrite($file, $details); fclose($file); ?>

Go Back

any help would be greatful

That’s because how you open the file, there are a lot of modes, just look up which one you need:

https://www.php.net/manual/en/function.fopen.php

Sponsor our Newsletter | Privacy Policy | Terms of Service