Hello
I am new for acf form. i created a form and display at front end. i used 3 types checkbox in this form. now i want to make a new page where i want to filter value according to multiple checkbox selection. how can i do? please suggest and guide me. its urgent for me.
I am used following code to display checkbox.
- Types of Resorts
<?php
$field_key = “field_541f312ae0bbd”;
$post_id = 254;
$field = get_field_object($field_key, $post_id);
$values = isset($_GET[‘type_of_resort’]) ? explode(‘,’, $_GET[‘type_of_resort’]) : array();
?>
<?php
foreach($field[‘choices’] as $choice_value => $choice_label ):
?>
-
<input type=”checkbox” value=”<?php echo $choice_value; ?>” <?php if( in_array($choice_value, $values) ): ?>checked=”checked”<?php endif; ?> /> <?php echo $choice_label; ?>
<?php endforeach; ?>
- Number Of Guests
<?php
$field_key = “field_541f30c6e0bbc”;
$post_id = 254;
$field = get_field_object($field_key, $post_id);
$values = isset($_GET[‘number_of_guests’]) ? explode(‘,’, $_GET[‘number_of_guests’]) : array();
?>
<?php
foreach($field[‘choices’] as $choice_value => $choice_label ):
?>
-
<input type=”checkbox” value=”<?php echo $choice_value; ?>”<?php if( in_array($choice_value, $values) ): ?>checked=”checked”<?php endif; ?>/> <?php echo $choice_label; ?>
<?php endforeach; ?>
- Wedding Feature
<?php
$field_key = “field_541f3355e0bbe”;
$post_id = 254;
$field = get_field_object($field_key, $post_id);
$values = isset($_GET[‘wedding_features’]) ? explode(‘,’, $_GET[‘wedding_features’]) : array();
?>
<?php
foreach($field[‘choices’] as $choice_value => $choice_label ):
?>
-
<input type=”checkbox” value=”<?php echo $choice_value; ?>”<?php if( in_array($choice_value, $values) ): ?>checked=”checked”<?php endif; ?> /> <?php echo $choice_label; ?>
<?php endforeach; ?>
But now i have no idea to display value according to these selection.
Thanks in advanced.