mercredi 23 décembre 2015

Multiple checkbox to just show whats checked

Hi I have my code for a checkbox function, When checked I want the search results to show just what is selected.

Example = Checkbox a Checkbox b

when checkbox "a and b" are selected then the search results will only show elements with "a & b".

Where at the moment i only get search results with "a or b"

My code is as follows:

variables as $var) { ?>
        <div class="property-type-filters">
            <fieldset>
                <?php foreach($var->varcatitems->variable as $var) {
                    $not_checked = strpos( $request->variables, $var->variableid."-".$var->variablebool) === false;

                    ?>
                    <label class="third-margin <?=$not_checked ? "" : "selected" ?>"><input type="checkbox" name="variables[]" <?= $not_checked ? "" : "checked" ?>  value="<?=$var->variableid."-".$var->variablebool?>" />

                    <img src="/wp-content/themes/test/images/feature-icons/<?=$var->variableid?>-feature-icon.png" />

                    <p class="variable-name"><?=$var->variablename?></p></label>
                <?php } ?>
                <?=$var->varcattable ?>
            </fieldset>

---Out put url is url= variables[]=34181-1&variables[]=44864-1

If anyone can help I would be very greatful.




Aucun commentaire:

Enregistrer un commentaire