I recommend that instead of typing in names, you open/read through the .txt file and make a list of the existing names, then produce a select/option menu so that someone can just select an existing name, rather than to type it in with the potential for typos not even finding a name. You would use this select/option list for the delete and update operations. Having a list (array) of the existing names in your code will also let you validate any new name, to make sure it doesn’t already exist.
Next, you have shown an ‘add’ column form field and column name and value form fields. If you are going to have multiple named columns, you should store each piece of information as - column_name:value. You would separate each piece of information using a different delimiter, such as a | (pipe.) The data structure would become - Firstname:Lastname|column_name1:value1|column_name2:value2|…
If you are going to have multiple named columns, you should input and store the column names into a separate .txt file. This will allow you to produce a select/option list when you need to pick which column of data to operate on. Creating new columns should be a separate process from the data entry form.
The easiest way to actually update or delete the row of data, would be to read the entire contents of the .txt file into a php array, with the main array index being the composite Firstname:Lastname value, and the array’s data being an array of the exploded name:value pairs. To delete the row, just delete the matching entry in the php array, then write the remaining data back to the .txt file. To update the row, replace the correct value, by using the column name to index into the array, then write the data back to the .txt file.