RE: [PHP] extract($_POST)

From: Date: Sat, 26 Oct 2002 22:03:18 +0000
Subject: RE: [PHP] extract($_POST)
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-121558@lists.php.net to get a copy of this message
> > Then make sure $id is a number. You can use is_int, or (int), or > whatever. > > It appears that any numeric values passed via the URL (..?param=10001) are > automatically treated as strings. If I pass ?param=1001 to the following > script... So turn it into an integer. $param = (int)$_POST['param']; It'll be turned into an integer or anything after a string part will be chopped off. 10001 => 10001 1000f => 1000 f1000 => 0 Validating can be that simple. You may also want to check the range of the number. Again, validating is unique to your application. What do you expect the value to be? If the value is XXX, how does that affect my application? ---John Holmes...

« previous php.general (#121558) next »