I’m working on a website for fun where the user enters something into two <input> elements in a form, presses submit, and then the text is logged to a .txt file, then the user is sent to a page for confirmation.
Is this possible to do with a form, and does it require javascript?
The basic structure of something like this would be:
<form method="post" action="">
<input type="text" />
<input type="text" />
<button type="submit"></button>
</form>
Thats possible without javascript.
You need to give each
inputanameand replacebuttonwithinput.Here is a start:
You can use
$_POST['field1']and$_POST['field2']to get the values and log them.FILE_APPEND is used to add new content to the end of the file instead of overwriting it.
LOCK_EX is used to aquire a write lock for the file (in case multiple users post at the same time)