How to check user input before submitting in php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
cool30
Forum Newbie
Posts: 12
Joined: Fri Jun 05, 2009 12:55 am

How to check user input before submitting in php

Post by cool30 »

I have a form called Customer.php. Once the user enters his/her name , the data is sent to CustomerData.php. I want to know how can I check if the user entered the name or not and also the Customer.php form to display error asking the user to enter the name before the data is sent to CustomerData.php.
I'll appreciate any help.
Thanks.
Eric!
DevNet Resident
Posts: 1146
Joined: Sun Jun 14, 2009 3:13 pm

Re: How to check user input before submitting in php

Post by Eric! »

Google javascript form verification. However you should always filter user fields in php because javascript can be bypassed by hackers.
cool30
Forum Newbie
Posts: 12
Joined: Fri Jun 05, 2009 12:55 am

Re: How to check user input before submitting in php

Post by cool30 »

Hi, I a Data.php page in which the user enters the data. Once the data is entered , it is directed to another page validating.php. However if the user does not enter the data, I am sending the page back to Data.php using header. It works just fine. I want to know that how can I prompt the user to "Please Enter Data" on Data.php page and how can this be done.
Thanks.
Post Reply