I am trying to update a text file depending on a value entered in a form, the text file's format is
The values retrieved from the form will be either Accepted or Rejected for the Approval field and the id eg 1.
I would like to update the Approval field in the text file, so far I have exploded the file by rows (/n) then by tabs (/t) to capture each cell, and I can find the line with the correct ID. How should I change the Approval field ? what file mode should I use?
I have had a few tries but failed so far, should I change the value of the cell then implode the cells and rows and overwrite the previous file? Thanks for any advice
Code:
Name ID Approval
Derek Smith 1 Pending
Gopi Chan 2 Approved
The values retrieved from the form will be either Accepted or Rejected for the Approval field and the id eg 1.
I would like to update the Approval field in the text file, so far I have exploded the file by rows (/n) then by tabs (/t) to capture each cell, and I can find the line with the correct ID. How should I change the Approval field ? what file mode should I use?
I have had a few tries but failed so far, should I change the value of the cell then implode the cells and rows and overwrite the previous file? Thanks for any advice