Busy building my first web application in CodeIgniter and wanted to work out the best way of gathering ID in my Admin function for Edit, Delete statements.
I realised I can use any of the following:
- Pass the ID through the controller.
- Collect the ID from the URI segment.
- Collect the ID from a hidden form field.
Which is the best based on security concerns. i.e. People fiddling with the URL, etc.
I prefer to use the URL for unique IDs, that way you get nice-looking URLs that people can bookmark. You shouldn’t rely on how you pass the data for security, you should be doing input validation within your controller regardless of how you pass it.