Jump to content

Blank Field Check


Guest ti2d

Recommended Posts

Does anyone have a simple script that automatically checks if any field in a form is empty? The help is really appreciated.

Link to comment
Share on other sites

This is normally something you'd do with javascript before the form has been posted, but if you want to do it with php then you could use a simple if statement to test each field. The best way to do it would be an if with an is not (=!) clause to which will return true if the value isn't empty. Something like:

if($_POST('fieldname') =! ''){code to be executed}

This can be followed by an else clause if you want it to do something special if the field is empty.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...