Click to See Complete Forum and Search --> : form validation


fogofogo
04-26-2006, 09:52 AM
Hello all - probably a simple one, but not for me!

I'm trying to check if a variable from a form has any spaces in it. I don't want to strip out the whitespace (as its a username and password), but display a warning.

Heres what I have so far:

if( !eregi("^[a-z0-9]+)*",
$_POST ['nickname'])){
readfile("blankfields.html");
exit;
} else {
}

Any suggestions?

Thanks

fogofogo
04-26-2006, 11:02 AM
got a solution if anyone is interested:

if ( substr_count ($string, " ") > 0 ) {

// We have spaces

} else {

// We don't

}


thanks