Filter / Search

3 posts by 2 authors in: Forums > CMS Builder
Last Post: March 3, 2011   (RSS)

By Toledoh - March 2, 2011

Hi Guys.

I've got a simple table on a list viewer page.

I've included the following search code at the top of the table with the aim of filtering the table by "tag".

The tag is a multi-select list.

I'm having 2 issues.

1. If a record has picked the tags "builder" and "plumber", the select option show a single option as "builderplumber". How do I get these as separate choices?

2. The submit results in a page of results, however that page shows the filter with the drop down consisting of only the item I chose, not the full list of tags. Whats the best way of handling this? I could go to a jQuery function, but the client really hasn't paid for that level of functionality.

<?php
$group = array();
foreach ($business_directoryRecords as $record){
$group[$record['tags']]=$record['tags'];
}
?>

<form method="POST" action="<?php echo $_SERVER["PHP_SELF"]; ?>">
<input type="text" name="title,name_keyword" value="">
<select name="tags">
<option value="">select</option>
<?php foreach($group as $tags): ?>
<option value="<?php echo $tags;?>"><?php echo $tags;?></option>
<?php endforeach?>
</select>
<input type="submit" name="submit" value="Search">
</form>

Cheers,

Tim (toledoh.com.au)

Re: [Jason] Filter / Search

By Toledoh - March 3, 2011

Thanks Jason.

The first part worked a treat.

I couldn't get the 2nd bit to work, but that's fine, I'll just to a results page.
Cheers,

Tim (toledoh.com.au)