Re: Using php to verify fields in form...

From: Date: Mon, 29 Oct 2001 18:43:43 +0000
Subject: Re: Using php to verify fields in form...
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-72758@lists.php.net to get a copy of this message
I believe he was asking how to actually verify them, but I could be wrong... There are two ways to do it that are quick and painless. One involves matching with a regular expression (and since my regular expression knowledge is no longer up to snuff I won't even attempt to explain it in depth). The other is with the String functions. There are about 900 ways to do it with string functions. Here is a for-instance: To verify that there is a @ in an email address: $test = strpos($email, "@"); // Test >= 0 if true, FALSE if false You can also tokenize the string using the strtok() function and then compare both the user ID and the domain/host information to your desired conditions. All in all. the best way is with a regular expression. However, you'll need to get help from someone else on that as I've forgotten most of the stuff about regex's. Spent too much time progrmaming other things :) Mike Frazer "Richard Hollis" <rhollis@keypoint.demon.co.uk> wrote in message news:20011029182205.77075.qmail@pb1.pair.com... > form passes to your php file > > your php file checks the variables with the same name of that of the form > fields. > > you can then test htey have all been set accordingly > > e.g. > > $FieldName etc. > > > "Jason" <jlgerfen@hotmail.com> wrote in message > news:20011029172548.34104.qmail@pb1.pair.com... > > I am new to php and I have been using a book to learn a bit about it and > > well I could not find a chapter on how to use php to verify a form is > filled > > out properly, for instance I have a form with 3 fields... name, email and > > words. once the user clicks the submit button i want it to verify those 3 > > fields before running the php script to pass the info to a database. I > have > > used java-script for this function in the past but would like to use php. > > Anyone know how i can accomplish this? Thanks in advance, Jason > > > > > >

« previous php.general (#72758) next »