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.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *