> I am working on a generic JavaScript form checked, that takes the > names > of the elements, with the first two letters being the type of element, so > its checks that it is right, if not gives a generic error message e.g. YOu > Need To Fill this in and selects it, or Sorry only numbers are allowed in > this box or Email addresses only, so reemail could mean a field which is > required and an email address. . > > JavaScript as long as you have a link to the object of the form, gives > the elements in an array. Is there a way to do this in PHP? Have a form > with > the action something like > register.php?action=updatemembers with members being a table name. The > elements would be checked like JavaScripts checks them. Ok I would need to > then set the order and manually do the call to the database, but it would > be > nice not to have to do the manuual checks on the elements. > > So a function to check all the elements in a form in PHP would be > nice, > then if it fails it would return an array with the wrong fields, and the > error, this could then be used to make a page where they correct there > mistakes.
I don't really understand what your question is, but I wouldn't recommend this method. What's to stop me from downloading your form, editing the name of the form elements and having you correctly validate some text when you normally think it's going to be a number? It all depends on how you implement your form, but it can be easily exploited if you don't know what you're doing. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php