I know I need to use them on user input fields such as a username entry field, but what about for radio buttons such as a gender option?
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
A pop quiz:
Given a small HTML form snippet:
and your server-side code:
How many ways is this code wrong?
@Basic, at mininum, here's the 'big' errors:
Not so big a deal when only the gender of a student is at issue. Maybe a form letter goes out about "Ms. Robert" and "her" latest detention.
Very big deal if it's an online banking site and the SQL injection just transferred your chequeing account's balance to some offshore account in the Cayman Islands.
A nice way that you could secure your inputs from $_POST is by running array_map() this is much quicker than a manual foreach().
You can even encapsulate the process of this by making a getPost() function.
Hope this helps.