Server-Side Form Validation

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I know, I know, there's a ton of form validation questions already in
this group.  However, I can't seem to make sense of any of the posts -
none go into detail.

All I need is to validate my form with 'post' method on the server
because my terminals' JavaScript abilities are questionable.

So far I've created a global error flag that gets raised whenever a
form field's value is invalid.  However, though that accomplishes the
task of validating the form, it DELETES all information from ALL form

I know that in .net it's a built-in feature, but in php I'd have to
write some, what do you call it ... ah, yes ... BOILER PLATE code.

Any way to do that?  The forms must be validated server-side.  Thank

Re: Server-Side Form Validation

Quoted text here. Click to load it

JavaScript abilities are ALWAYS questionable because it can be
turned off, and it's not present in programs like telnet and CURL
that can be used in place of a browser.  Input validation for
security or data-integrity should be done on the server, and possibly
also in JavaScript also for user-friendliness and immediate
notification of an error.

Quoted text here. Click to load it

When you re-paint the form, you can output HTML to put the submitted
values (or just the ones that pass validation) into the new copy
of the form (VALUE="...").

                        Gordon L. Burditt

Re: Server-Side Form Validation

Thanks.  I suspected I'd have to do that.  Any way to streamline the
process and re-use the code for other forms?

Re: Server-Side Form Validation

Carved in mystic runes upon the very living rock, the last words of  
TristaSD of comp.lang.php make plain:

Quoted text here. Click to load it

Check out Phorm, either to use or to get ideas of your own. It has pretty  
thorough data validation capabilities, with form recycling. Just bear in  
mind that I've learned a lot since I wrote that section, so there's some  
room for improvement :)

Alan Little
Phorm PHP Form Processor

Site Timeline