我可以将post.php永久保存吗?

For my website you can visit here at http://desire.site88.net at the very bottom you will see my form. When you finish with the form and press submit the form submits the data to desire.site88.net/post.php . What I'm curious is how do I make it permanent? When the user submits data to post.php I want it to stay there. Not looking for anything secure or unhackable, just something I can use to recruit members. Here is my code

<?php

$username = $_POST['username']; 
$email = $_POST['email']; 
$message = $_POST['message']; 

// what it will say down below
echo $username. ' has an email of </br>'; 

echo $email. ' and wants to join because </br>'; 

echo $message. '</br></br>'; 

<form method="post" action="test.php"> <div class="row 50%"> <div class="6u 12u(mobile)"><input type="text" name="username" placeholder="Username" /></div> <div class="6u 12u(mobile)"><input type="email" name="email" placeholder="Email" /></div> </div> <div class="row 50%"> <div class="12u"><textarea name="message" placeholder="Application" rows="6"></textarea></div> </div> <div class="row"> <div class="12u"> <ul class="actions"> <li><input type="submit" value="submit" /></li> </ul> </div> </div> </form>

So reading your previous comment about looking for a simple way to collect data without the need for security, I recommend saving it in a text file for now, and maybe later using XML, which you can investigate into later.

code to save into a text file:

$filePath = $username."-".time().".txt";
$myFile = fopen($filePath, "w");
fwrite($myFile, ("username: ".$username."
"));
fwrite($myFile, ("email: ".$email."
"));
fwrite($myFile, ("message: ".$message."
"));
fclose($myFile);

that code will save a file with a unique name each time it is saved, and it would be located in the same directory as your php page.

let me know if that worked for you or if you have any doubts :)

Edited: Explaining first how the function fopen() works. Placing "w" in the second parameter means the function will create a new file with the information you give it, and if the file already existed, it will re-write it, meaning any previous information that existed in the file will be gone. For this reason, I made the $filePath unique, so that no overwriting happens. I will now go a bit further and include the logs in a new separate file that is outside the root folder for added security:

//++++ path obtained to your root folder
$root_directory_path = $_SERVER['DOCUMENT_ROOT'];
//++++ creating the path for the logs in a new folder outside
//++++ the root director
$filePath = $root_directory."/../my_logs/".$username."-".time().".txt";

//++++ starting the creation of the file
$myFile = fopen($filePath, "w");

//++++ inputing information into the file
$inputString = "username: ".$username."
";
fwrite($myFile, $inputString);

$inputString = "email: ".$email."
";
fwrite($myFile, $inputString);

$inputString = "message: ".$message."
";
fwrite($myFile, $inputString);

//++++ closing the file / finalizing the creation of the file
fclose($myFile);

I visited your site and it seems you are having issues with the permissions that the site gives you. If you still wish to user text files inside the root directory, you can follow the code below, however be informed that anyone can view the users that are registered since the information is being saved in a subfolder of the rood directory, so I do recommend transitioning to a database that is secure:

$filePath = "/myLogs/".$username."-".time().".txt";
$myFile = fopen($filePath, "w");
fwrite($myFile, ("username: ".$username."
"));
fwrite($myFile, ("email: ".$email."
"));
fwrite($myFile, ("message: ".$message."
"));
fclose($myFile);