Hi all,
I am trying to create a search filter against certain values in a table field.
I can get the following code to work but it is only allowing search against a single value.
<form method="POST" action="<?php echo $_SERVER['PHP_SELF'] ?>">
<select name = "serviced_accommodation_facilities" >
<option value="">Please Choose a Category</option>
<?php foreach (getListOptions('advertisers', 'serviced_accommodation_facilities') as $value => $label): ?>
') as $value => $label): ?>
<option value = "<?php echo $value;?>" <?php selectedIf($value, @$_REQUEST['serviced_accommodation_facilities']);?>>
<?php echo $label; ?></option>
<?php endforeach ?>
</select>
<input type="submit" name="submit" value="Search" >
</form>
However I want to use a multi select option using bootstrap multiselect, I can get the list to display and select multiple values however when I do the search It doesnt filter anything out, it just displays all the records even when just one element is selected.
I know it must be something simple and probably immediately obvious to someone with php or mysql knowledge, neither of which I have so my efforts tend to originate in copying code from somewhere and then trying to get it to work via trial and error, only this time I am pulling my hair out and getting nowhere but seem so close.
My multi list code is shown below, if someone can advise where the issue is and why the above option works and the below one doesn't I would be extremely grateful. I am assuming it is nothing to do with the headers etc given that the above filter does work.
As always, thanks in advance for any help provided
I have noticed that the working filter uses
<select name = "serviced_accommodation_facilities" >
and the multi list version uses
<select id = "serviced_accommodation_facilities" multiple="multiple" >
is this relevant?
<!-- Multi Selection Form -->
<!-- Initialize the plugin: -->
<script type="text/javascript">
$(document).ready(function() {
$('#serviced_accommodation_facilities').multiselect();
});
</script>
<form method="POST" action="<?php echo $_SERVER['PHP_SELF'] ?>">
<select id = "serviced_accommodation_facilities" multiple="multiple" >
<option value="" disabled selected>Required Facilities</option>
<?php foreach (getListOptions('advertisers', 'serviced_accommodation_facilities') as $value => $label): ?>
<option value = "<?php echo $value;?>" <?php selectedIf($value, @$_REQUEST['serviced_accommodation_facilities']);?>>
<?php echo $label; ?></option>
<?php endforeach ?>
</select>
<input type="submit" name="submit" value="Search" >
</form>