What is the primary purpose of using PHP's htmlspecialchars() function in form handling?
- To store form data securely in the database
- To remove special characters from user input
- To convert user input into HTML entities
- To encrypt sensitive data
PHP's htmlspecialchars() function converts special characters to their HTML entities, preventing Cross-Site Scripting (XSS) attacks by rendering user input harmless.
Loading...
Related Quiz
- Which network type spans a large geographic area, often connecting multiple cities or even countries?
- How do you use the $_GET superglobal in PHP?
- Which of the following functions can be used in PHP to find the length of a string?
- What is a common use case for the $_REQUEST superglobal in PHP?
- You have a PHP script and you need to call a user-defined function using a string variable. How would you do this?