Form validation

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
gkwhitworth
Forum Commoner
Posts: 85
Joined: Tue Sep 05, 2006 8:28 pm
Location: Wasilla, Alaska

Form validation

Post by gkwhitworth »

Ok, at my work my boss is a MS fan, big time and she forces us to use bloody Frontpage. I have a form for a client and have tried using MS extensions and their stupid form properties to validate the text-area to only 300 characters, about 50 words. Only, it doesn't work worth crap. I have tested it several times and it has allowed me to write thousands of characters many times.

I have done simple form validation using the empty() code, but I need something like:

Code: Select all

if (comments == "# of characters") {
echo "sorry please try again";
}
Now remember, the form isn't be sent with PHP so there are no variables to pass or anything. The text-area's name is "bio."

--
Greg
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Re: Form validation

Post by volka »

gkwhitworth wrote:Now remember, the form isn't be sent with PHP so there are no variables to pass or anything.
meaning?

Is the form's method post or get?
strlen() returns the length of a string.
User avatar
gkwhitworth
Forum Commoner
Posts: 85
Joined: Tue Sep 05, 2006 8:28 pm
Location: Wasilla, Alaska

Post by gkwhitworth »

Thanks volka I will try that, I got the MS Extensions to work....man do they suck. Unfortionatley they don't want to do the entire form in PHP, maybe next year right?
Is the form's method post or get?
It is using POST, but I didn't want people to think that the form was using PHP, I now realize that that really doesn't matter, but I thought I would cover my bases.

--
Greg
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

Then the parameter should be represented by $_POST['bio'] and strlen($_POST['bio']) should return the length of it.
Post Reply