I have the following part of code in my file.
<?php
$output = "<font id=''>" . $_POST["input"] . "</font>";
file_put_contents("output.html", $output, FILE_APPEND);
?>
The user can submit the form several times, and each time, the value entered in the input-field will be saved into a file. What I want to do, either with PHP or JavaScript, is to add consecutive numbers in the id
attribute for each value submitted.
Example: user enters <kbd>hello</kbd> and submits form. Only <font id=''>hello</font>
will be written into the file. What I want to do is to write 1
in the id
attribute for the first value submitted (<font id='1'>hello</font>
). For the second value, to be written 2
, 3
for the third value, etc.
Is it possible to do this? If so, how?
Thank you.