Re: [PHP] checking to see if value is a integer from a form text field

2001-02-15 Thread Richard Lynch
Data coming from a POST or GET is a string, by definition -- A URL just doens't contain any data type information, and PHP isn't going to sit there and try to guess what the data type of $x should be. You'll need to check its validity as an integer by using something like this: if (strlen($quant

RE: [PHP] checking to see if value is a integer from a form text field

2001-02-15 Thread Jason Murray
> 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),