I have a code of a form that writes the "email" of user into a .txt
file in my server.
Here are some things I want to do: Make the form have more than one variable (Like, one line to "name" and another one to "email"), put the form writing in .txt
prefixes before the "input" texts, and make the output .txt
file have line breaks between the contents of each variable.
Here is my code currently
<?php
if(isset($_POST['submit']))
{
$email = $_POST['email'];
$file = fopen("emaillist.txt","a+");
fwrite($file,$email);
fclose($file);
print_r(error_get_last());
}
?>
<form action= "" method="post" name="form">
Email:
<input type="email" name="email">
<br>
<br>
<input type="submit" name="submit" value="submit">
<br>
</form>
Can you help me? Thank you all.