Creating a kiosk-type php form to filter out content

How do I do an interactive, drill-down kiosk in php? That is, a succession of questions helps the visitor to narrow down the number of products to those that match the criteria selected in the questions.

Here is an example of what I want to see:

1. Do you want an assembled vehicle, or a kit you put together yourself?
[ Assembled RTR ] [ Kit ] ← these are buttons

*** NEW SCREEN and new questions and buttons when above are clicked: ***

2. Do you want an electric-powered vehicle, or nitro-power?
[ Electric ] [ Nitro ]

*** NEW SCREEN and new questions and buttons when above are clicked: ***

3. Do you want a buggy, truck, monster truck, or touring car?
[ Buggy ] [ Truck ] [ monster truck [ touring car ]

*** Final NEW SCREEN showing filtered list as thumbnails ***


To make this work, each vehicle needs three columns in the DB to include the appropriate terms:

  1. assembly column: rtr, kit
  2. power column: electric, nitro
  3. body column: buggy, truck, monster truck, touring car

Each time a selection is made, the array is filtered out.

  1. Query the DB for car and ‘rtr’ | ‘kit’ and put results in an associative array:
    $assembly = array
    [‘carName1, rtr’];
    [‘carName2, rtr’];
    [‘carName3, rtr’];
    [‘carName4, rtr’];
    [‘carName5, rtr’];
    [‘carName6, kit’];
    [‘carName7, kit’];
    [‘carName8, kit’];
    [‘carName9, kit’];
    [‘carName10, kit’];
    [‘carName11, kit’];

  2. If ‘kit’ is chosen, query the DB based on the ‘kit’ in array and build a new associative array for ‘electric’ | ‘nitro’. Then show only buttons where the value of ‘electric’ and nitro’ are available, for not all vehicles will be available in both:

$power = array
[‘carName6, electric’];
[‘carName7, electric’];
[‘carName8, electric’];
[‘carName9, electric’];
[‘carName10, nitro’];
[‘carName11, nitro’];

  1. If ‘electric’ is chosen, query the DB based on the ‘electric’ in array and build a new associative array based on body type, and show only buttons for which there are body types available ('monster truck is not available in the array, so it is not shown as a button):
    $body = array
    [‘carName6, buggy’];
    [‘carName7, truck’];
    [‘carName8, buggy’];
    [‘carName9, touringCar’];

  2. If ‘buggy’ is chosen, query the DB based on the ‘buggy’ in array and show clickable thumbnails of the vehicles.

Is this the correct way to go, or is it the long way or wrong way? I have not done PHP or MYSQL for a few years and want to do this as an personal exercise, then show the current web designer how it could be done.

I’m not asking for full code, but for a direction in which to go.

I had a similar sort of problem and could not find a answer the site owner liked and I am no longer working on the project so it was never resolved.

Going through page after page would annoy me and a JavaScript method would probably be better as you stay on the same page and the options in the boxes update as the previous questions are answered. This was one problem I had; the site owner was adamant he did not want to use JavaScript; the othere was the vast array of options.

Edit: I have a thread here discussing the method I tried to use but can not find it.

I think the way that would be the most manageable would be to have sequential PHP page loads using form values passed to it from the previous page to populate the new page. But as said, not the best user experience.

JavaScript would mean more code making XHR calls and changing the DOM but would be more user friendly.

An interesting way that would be a nightmare to code but doable and would not need sequential page loads or JavaScript would be to use the :checked pseudo-class (page has demos)

Does this sequential process have a name I can search by so I can get more ideas?

I think the term you’re looking to use is “conditional form fields” or “conditional logic form”

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.