提前搜索表格

Maybe is a stupid question but i really need this.

I need to find a good solution for my advance search form with many selectboxes and checkboxes.

So this is the scenery:

step 1.When the user change the selectedbox value make a select in database with the selected values; step 2.When the user check a checkbox the script need to make another select based on the selected value from the first step. I need to use PDO and AJAX.

Thanks a lot.

Depending on your amount of checkboxes you could do something like the following beneath.

For example we take festivals and concerts for our selectbox

<select>
    <option value="0">Click me</option>
    <option value="1">Festivals</option>
    <option value="2">Concerts</option>
</select>

In our Database we create a table "events".(again this is just an example because you have not provided a set amount of code) In events we have the columns:

event_id
event_name

And to put this in our working example we would have:

--------------------------
| event_id | event_name |
| 1        | Festivals  |
| 2        | Concerts   |
--------------------------

For your checkboxes you could have something that searches through countries(Were are the festivals / concerts) or a genre(rock, house, etc). I think this would be better to specify under radio buttons instead of checkboxes, maybe even another <select> option

Example of tables for countries:

------------------------------------
| country_id | country_name       |
| 1          | The Netherlands    |
| 2          | Great-Brittain     |
------------------------------------

Example of tables for genre:

--------------------------
| genre_id | genre_name |
| 1        | Rock       |
| 2        | House      |
--------------------------

Now you can dynamically create <options> inside your select using SQL queries.

When doing so you can also continue to use a trigger for a jQuery function/JavaScript function/AJAX call on for example the .change(jQuery listener) of your <select>.

When doing an AJAX call(sending parameters/variables to another .PHP file which will give results back) you can put every outcome of your Query(Fetched results) inside a <option> in a <select multiple>, if you put it in a <select multiple> you can easily see all results

I hope I have steered you in something of the right direction.