Re: ICQ # validation

From: Date: Mon, 03 Mar 2003 19:08:42 +0000
Subject: Re: ICQ # validation
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-137950@lists.php.net to get a copy of this message
On Mon, 3 Mar 2003 14:00:43 -0500, you wrote: >Maybe I'm off my rocker, but I don't see how this can't work. I'm trying to >validate an ICQ number, and assuming a valid one is between 7 and 9 numbers. My line of code is >this: > >if(ereg("^[0-9]{7,9}$", $_REQUEST["icqnumber"])) { > print("a-okay!"); >} else { > print("error msg"); >} > >I've submitted the ICQ # 2264532680, but it validates. Any ideas? if (ereg ("^[0-9]{7,9}$", "2264532680")) { print ("a-okay!"); } else { print ("error msg"); } fails. I suspect you're not grabbing the variable from the environment correctly.

« previous php.general (#137950) next »