> I have a strange problem, when a user inputs the quantity
> into a text input field in a cart, I want to be able to test
> to see if the value is a integer if it isn't then default it to 1
>
> if ( !is_int($Qty) ) {
> $Qty = 1;
> }
Off the top of my head (and thus probably hideously wrong), how about:
$ActualQty = ereg_replace("[^0-9]", "", $Qty);
if (intval($ActualQty) <= 0)
{
$Qty = 1;
}
Here we're removing everything that's NOT between 0 and 9, and then
checking to see if the variable has a value.
Jason
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]