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.
Loading...
Related Quiz
- What is a common use case for the $_SERVER superglobal in PHP?
- How can you retrieve the value of a specific cookie in PHP?
- What are some common uses of the include statement in PHP?
- To ensure an uploaded file is not malicious, one should validate the file's ________ before saving it.
- The $_SERVER superglobal in PHP is often used to get the URL of the current page.