Hello.
I'm looking for a suggestion(s):
I'm writing form data to a file that includes a delimiter. The data originates from $_POST so the number of vars (form fields) can change at anytime in the future.
In order to make collecting data with minimal fuss, therefore, I want to add a header line upon these conditions using a single flat file:
1) when there is an empty or new file, make the 1st line the header followed by the data line entry - this can occur when the file reaches a certain size then create anew with the appropriate file permissions e.g. 620;
2) whenever the $POST vars change, add a blank line (skip a line) followed by the new header line followed by the data line. The $POST var changes either more or less as fields on the form changes;
3) repeat as changes to $_POST structure changes.
The header line is already constructed to be fluid (adapt to changes to the $POST var). How to create the writing to the file is the issue for Step 1 & 2 above - how the script knows that the $POST array structure has changed and to write the new header line after skipping a line is the challenge.
Thanks.