RE: form validation

by Klaas De Waele <klaas(at)gracegraphics.be>

 Date:  Fri, 8 Feb 2002 17:09:17 +0100
 To:  "'Buddy Harris'" <bharris(at)stny.rr.com>,
"'HWG techniques'" <hwg-techniques(at)hwg.org>
  todo: View Thread, Original
In general, server side scripting is when you submit your form and then the
resulting page checks if you've filled in everything correctly.

A cryptic example:

----
if [ form.firstname = "" then go back to previous page ]
else [ mail form.firstname to me(at)myhost.com ]
----

So... if they didn't fill in their name (the "firstname" field of the form)
they will be taken back and they will get a message to fill in their name.

If they did fill in the name, it will be sent through email.

Believe me, in practise it requires some more lines and other commands and
probably you have some more form fields, but I think this explains how it
works.  The thing is it's the server who checks if the data is correctly
filled in, and since the user generally doesn't control what happens on the
server and also doesn't require you to have some browser plugin installed,
it will leave less room for errors etc...


- Kayjey -
www.fiatcoupe.net





-----Oorspronkelijk bericht-----
Van: owner-hwg-techniques(at)hwg.org
[mailto:owner-hwg-techniques(at)hwg.org]Namens Buddy Harris
Verzonden: vrijdag 8 februari 2002 14:31
Aan: HWG techniques
Onderwerp: Re: form validation


> > Okay, so where might I find a server side script to validate the form?
Would
> > I have to use a SSI to include the file? Does it go in the.htacces file?
I'm
> > clueless about this kinda stuff.
>
> No they mean the script on the server that will process
> the form data needs to do form validation.
> HTH
> As Always
> r

They're talking about using something like I sent (personally, by accident).
To add to your perl script.

$MyVariable = param("field_name");
 if (! $MyVariable) {
print "<h1>HEY, HOW CAN I SEND THE ITEM IF I DO NOT KNOW YOUR
ADDRESS??</h1>\n";
print "<br><a href=form.html>Go Back</a>\n";
exit;
}

# The "$MyVariable = param("field_name");"  might be "$MyVariable =
$FORM{'field_name'}".  You can see how
fields are specified by looking at your script code.

The "!" means "not" to perl.

HTH,
Buddy

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA

This page is part of a preserved archive of archives.hwg.org. The site is no longer active and its content is not maintained. For enquiries about this archive, write to archive(at)iwanet.org.