Jump to content

Form Vailadation


airportmarc

Recommended Posts

Hey there all,

 

So I am trying to validate users inputs from forms using PHP.  I have a few different functions that check the email,dates,text,etc..  But I get loss when trying to implement them on a bunch of different forms.  there are about 10-15 different forms that need to be checked (all on different pages) and i am trying to find the most efficient way of doing this. My current idea is to create a  different function for each form that checks the correct fields for that form.  So if form1 has 2 text fields, 1 date field, 1 email, a function call form1 is called and within that it checks 2 texts, 1 date and 1 email...  Is this good programming style?

 

Also, I am looking for a better way to report any errors to the user.  Currently the functions return a string saying something like "thank you" or "Sorry that was incorrect".  I am looking for a way to build an array or error(s) as they come up and display that to the user. 

 

I hope this is clear, please ask if you need further clarification. 

Link to comment
https://forums.phpfreaks.com/topic/112238-form-vailadation/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.