For checking the emptiness, using either isset() or empty() would be fine. If you want do more strict and/or complex validations, match functions would be good in my view.
What about if a user input a not matching record… how is that call NULL?
For instance user input then it is submitted and set then the value can be NULL or empty at this point. The form is going to look in a database a record that matches the input of the user with the one in the database. But as I said “coloso” string was input but is not in the database, How the value is call at that point?
I am talking about a form that will retrieve and display data back from the database out of the user input.
The form i have posted above is for sending a e-amil with the name, email and message of the users.
Right now I am trying to validate two type of forms. One that retrieve and display info form that will submit user information and try to match with some database info. And another form that is for sending e-amil, name and a message to my mail box
Hi Dan, thanks for clarifying this. the text input is set even the value is empty. but it works for checkbox and radio inputs. and sometimes isset() even works better then empty(), for example, ‘0’ is a valid option of a radio button.
Validation is up to you. Perhaps you ask for a persons height, then perhaps you should check that someone didn’t enter 200ft tall, or 57 feet when they meant 5’7, or five instead of 5.
There is no simple way to do this. Even emails, so the email is valid, but it’s @example.com, or some other fictional address. But obviously there are some simple helpers, like checking for int, filter_var etc.