Re: PCRE regexp bug ?

From: Date: Fri, 15 Aug 2003 20:49:43 +0000
Subject: Re: PCRE regexp bug ?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-159757@lists.php.net to get a copy of this message
* Thus wrote tpc@csua.berkeley.edu (tpc@csua.berkeley.edu): > > I believe I spoke too soon. If I use isset() then even if I leave the > field empty it still returns true. I am trying to view the documentation for > this function but php.net seems to be timing out now. > > if (isset($_POST[MI]) && (preg_match('/^[[:alpha:]]{1,1}$/', $_POST[MI]) > > == 0)) That is because the browser is sending in the POST data: MI= Thus, php does set it to ''. Use something like this instead: if (strlen($_POST['MI'])) ... btw, you should really quote your array keys. HTH, Curt -- "I used to think I was indecisive, but now I'm not so sure."

« previous php.general (#159757) next »