PDA

View Full Version : form validation ?


Prabhakar
03-22-2006, 12:02 PM
hi all ,
I'm new to php, in my project i have 10 different forms and each form has got
more than 10 fields.

form1 :

Name <textfield>
Ph no <909080980>
sec codes <*78>
Name1 <textfield>
sec code1 <*79>
.....<checkbox>
sec code2 <*7>
sec code3 <*9>
extension <119>
.....<dropdown list>
.....
....


i am validating this using 3 diff functions .

validateText($string); // called twice for Name and Name1
validateAsterisktNum($astNum); //called 4 times wherever asterisk is there
validateNumber($number); // called twice for ph no and extension.

is this the better way or i have to call the ValidateText only once for passing two args at a time. or validateAstNum only once passing all the four args at a time.

i am bit confused.
suggest me better way to validate the above form.



thanks in advance for the reply.

degsy
03-22-2006, 02:41 PM
It's still going to have to do the same amount of processing. I would keep the functions simple and transferable instead of writing them specifically and strictly for a form setup.