Skip to content Skip to sidebar Skip to footer

Adding Multiple Html Checkboxes With The Same Name To Url Using $_get

I have a search form for my website. The search form includes a category section where the user can select items from different categories, all of which are checkboxes. They all ha

Solution 1:

That's perfectly normal for a php-style array in a URL. You'll find that if you do print_r($_GET), you'll get something like:

array(
   'catID' => array(
       0 => 10,
       1 => 11,
       2 => 12
   )
   'otherparameter' => 'value'
)

and can get at the individual checkbox values with a simple

if (is_array($_GET['catID'])) {
     foreach($_GET['catID'] as$catID) {
        ...
     }
}

Post a Comment for "Adding Multiple Html Checkboxes With The Same Name To Url Using $_get"