My task on this project was to create a page where users could view and edit their personal details stored on the university database. It presented several challenges:
On the view page, users can view their current details (name, address, phone numbers etc.) and any pending changes they have made. To ensure that the user can only see their own details, SQL views are used that retrieve records based on the user's login credentials.
On the edit page, users can request changes to their current personal details. To tackle the problem of multiple records for parts of the form, recursion was used; that is, the page sends form data to itself when the user clicks a button. As a result, the user can click buttons to add or remove rows, and any changes the user has made will be stored in the POST data as the page reloads. This method avoids the use of Javascript.
Because some staff do not have their date of birth or start date stored in the database, validation had to be put in place to ensure that the system would not fail when inserting (presenting the user with a nasty SQL error message instead of the page). If either of these fields are missing, the system inserts a default date value (01/01/1900) and presents the user with a warning.