If not or if not array problem

I’m getting stuck with the array bit.

Basically I the first bit is fine, if regions is empty then carry on, then if regions is not a numeric then do this, but its then looking at the array and checking if that isnt numeric that Im getting stuck with.

if ($_GET['regions']=='') {    
} else { if (!ctype_digit($_GET['regions']) || (!ctype_digit($_GET['regions[]']))) {
header('Location: http://www.mysite.com/index.php');

Can you vardump $_GET['regions'] and post it here?


Hi, its a shame I posted so late as I had to leave the office and cant get access to the files. I will post back on Monday and hopefully I can get somewhere with it.


Morning s_molinari,

As expected when regions is empty var_dump gives me -

string(0) ""

When I select a region building the array I get

array(1) {[0]=>string(2) "89"}

With 2 regions selected

array(2) {[0]=>string(2) "89"[1]=>string(3) "221"}

Ok. I believe that means you’ll have to loop through the array, then test your conditions on each array element.


This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.