From your previous thread -
You can assign any value to a session variable. This can be any expression that produces a value, e.g. a literal value, another variable, the result of an operation or comparison, or the result of a function/method call. The actual value is stored in the session variable.
What does using a session variable have to do with this operation? You should have two forms. The update form should have a hidden field with the id, a hidden ‘action’ field with a value that indicates that the ‘update’ form processing code is to be executed, and the form fields containing the data values. The delete form should have a hidden field with the id and a hidden ‘action’ field with a value that indicates that the ‘delete’ form processing code is to be executed.
The form processing code and the form(s) should be on the same page. This results in the simplest code and the best User eXperience (UX), since you can display any user/validation errors and repopulate the fields with the submitted/modified values when you redisplay the form.
The code for any page should be laid out in this general order -
- initialization
- post method form processing
- get method business logic - get/produce data needed to display the page, such as the initial data being edited/updated.
- html document