Re: Looping through Form Elements in a form
| From: | Jason Wong | Date: | Wed, 11 Dec 2002 21:03:13 +0000 |
| Subject: | Re: Looping through Form Elements in a form | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-127899@lists.php.net to get a copy of this message | ||
On Thursday 12 December 2002 04:13, Steve Vernon wrote:
> Hiya,
> 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.
There are some classes in www.phpclasses.org which helps you validate forms.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
"An open mind has but one disadvantage: it collects dirt."
-- a saying at RPI
*/