jscix Posted March 12, 2007 Share Posted March 12, 2007 Basically what this does is retrive the $_get variable 'list', then if it's empty assign it an array of 0, 10 as default, otherwise grab the values on either side of the - delimiter. The problem is, when the default numbers are processed and I print the array I get: Array ( [0] => 0 [1] => 10 ) This works and it prints out 0 and 10. However.. when I specify the numbers, using "blah.php?list=0-10" I get the exact same array: Array ( [0] => 0 [1] => 10 ) However it is not printing out the numbers... It prints a null value... what is happening? anyone? $limitres = ($_GET['list']); if (!isset($limitres)) { $dirty2 = Array(0, 10); } else { $dirty = strip_tags($limitres); $dirty2 = explode("-", $dirty); } if (is_array($dirty2)) { $numof = count($dirty2); if ($numof != "2") { die("Invalid page limiter"); } $pone = $dirty2[0]; $ptwo = $dirty2[1]; if (is_int($pone) && is_int($ptwo)) { $clean1 = ($pone); $clean2 = ($ptwo); } if ($clean1 > clean2) { die("Page limiter format must be lesser number-greater number."); } } print $clean1 . "<br>"; print $clean2 . "<br>"; Link to comment https://forums.phpfreaks.com/topic/42396-solved-having-a-bit-of-trouble-with-this/ Share on other sites More sharing options...
jscix Posted March 12, 2007 Author Share Posted March 12, 2007 Hum, I figured it out. Sorry, The problem was with using the Is_int function, I replaced it with is_numeric. I suppose for some reason explode returns the values as a numeric string? Link to comment https://forums.phpfreaks.com/topic/42396-solved-having-a-bit-of-trouble-with-this/#findComment-205666 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.