A quick look at how to submit, retrieve and sanitize data all in one class.
The class itself should be pretty straight-forward to follow. Start with __construct() and follow main().
Overview
The class will edit an employees or user's details.
The class itself should be pretty straight-forward to follow. Start with __construct() and follow main().
Overview
The class will edit an employees or user's details.
- Instantiate the database connection, frequently used code and the forms class.
- Check to see if user id is passed through the $_GET method
- If not, retrieve all employees' table ids as well as their first and last names.
- Display a drop-down allowing the manager to select the employee to edit
- Once the selection is made, the id is made available via $_GET
- All user types are loaded into an array for later use
- All locations are loaded into an array for later use
- The user details are retrieved and sanitized prior to them being displayed
- Form is displayed and is populated with the employee's details
- Changes can be made to any field
- Once the form is submitted, each field is sanitized.
- Employees table is updated with the updated details
- If there were changes to the password, the users table is also updated.
- Confirmation message is displayed and the manager has the capability to edit the form again
Comments
Post a Comment