Page 1 of 1

php validation

Posted: Wed Oct 03, 2007 8:29 am
by zubkola
hi everyone.....

i'm new to php.i need your help.i want the validation code for user registration form.the fields are full name,address,email,password,confirm password ,date of birth,gender.hope [s]u[/s] you can help me....
[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:11. Please use proper, complete spelling when posting in the forums. AOL Speak, leet speak and other abbreviated wording can confuse those that are trying to help you (or those that you are trying to help). Please keep in mind that there are many people from many countries that use our forums to read, post and learn. They do not always speak English as well as some of us, nor do they know these aberrant abbreviations. Therefore, use as few abbreviations as possible, especially when using such simple words.

Some examples of what not to do are ne1, any1 (anyone); u (you); ur (your or you're); 2 (to too); prolly (probably); afaik (as far as I know); etc.

Posted: Wed Oct 03, 2007 8:53 am
by aceconcepts
Most validation scenarios are quite obvious.

Be careful with fullname, why not split it into first and last. Also beware of names containing special characters i.e. "-"

You can find lots of email validation scripts on the web (both PHP and Javascript.

passwords obviously need to be compared for integrity reasons and strlen() is often useful. Also, you will probably want to encrypt your password - md5()

DOB depends on what validations you want.

Gender could simply be a select list - Male or Female.

Posted: Wed Oct 03, 2007 11:20 am
by RobbieL
If you're new to PHP (like me), using a framework like Code Igniter may be helpful. Their built in validation in excellent, and very simple to get going.