Filter list by all records (Form Select Problem)

I have a table where a column can contain one or two values … ‘Edson’ or ‘Hinton’. I want to filter my results based on a selection from a select form element.

<select id="selectOffice" class="form-control form-control-sm" name="selectOffice">
   <option value="Edson,Hinton">Overall Program</option>
   <option value="Edson">Edson</option>
   <option value="Hinton">Hinton</option>
</select>

This works for the second two options. But with option one I want to display all records. Here is my query. I am using an IN filter.

How can I show all records when using a select form element? Do I need to have some sort of Array in my select value? Am I totally off base and this is not possible?

So in short, with option one I want to show all records that have Edson or Hinton as a value. I’d like the first selection (Overall Program) to show all records.

In my situation when I wanted ‘all’ results I did this

What I did was the all option was static for me so I added a value to the select with a value of ‘published’

Then when it comes to the query I have the IN function wrapped in a condition that only activates when the selects value is not ‘published’

If you need certain filters for when its on all ‘published’ in my example you could wrap this is a condition below but this time when the value is == ‘published’

Something like this may work for you there also maybe way better ways.

Here is my select input setup:

2 Likes

Hmmm, interesting. I have not used conditions yet. Didn’t even know it was an option actually. I will experiment with that today.

Thanks so much @Sorry_Duh for your reply! I am sure I will have more questions. :wink:

Success!! I owe ya a :beer: @Sorry_Duh! Thanks for introducing me to the world of conditions in my queries. Game changer.

Wappler is amazing!

1 Like