initilized array so no error in loop

This commit is contained in:
jorge 2023-01-28 15:44:41 +01:00
parent bce9973189
commit c2c7a7bb0f
1 changed files with 3 additions and 2 deletions

View File

@ -46,8 +46,9 @@ if( ! function_exists( 'ofisuport_ajuts_filters_form') ) {
// check for values in url and get value if available
if( isset($_GET[ $fieldname ]) ) {
$filteredvalues['value'] = explode(',', $_GET[ $fieldname ]);
} else {
$filteredvalues['value'] = [];
};
//end check for values in url
@ -60,7 +61,7 @@ if( ! function_exists( 'ofisuport_ajuts_filters_form') ) {
<?php foreach( $fields['choices'] as $choicevalue => $choicelabel ) { ?>
<div class="filter" data-filter="<?php echo $fields['name'];?>">
<input class="ofisuport-filter" type="checkbox" name="<?php echo $fields['name'];?>" <?php //if( in_array($choicevalue,$filteredvalues['value']) ) { echo 'checked'; }; ?> value="<?php echo $choicevalue ?>" />
<input class="ofisuport-filter" type="checkbox" name="<?php echo $fields['name'];?>" <?php if( in_array( $choicevalue, $filteredvalues['value']) ) { echo 'checked'; } ?> value="<?php echo $choicevalue; ?>" />
<label for="<?php echo $choicevalue; ?>"><?php echo $choicelabel;?></label>
</div>