You are building a registration form for a website. Users complain that they can submit the form with an empty name field. Which validation technique should you implement to ensure the name field is mandatory?

  • Client-Side JavaScript
  • Server-Side PHP Validation
  • HTML5 Required Attribute
  • Database Constraint (NOT NULL)
Server-Side PHP Validation should be used to ensure that the name field is mandatory. Client-side validation can be bypassed, and the HTML5 'required' attribute can be manipulated by users. However, server-side validation is robust and secure.
Add your answer
Loading...

Leave a comment

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