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:
- assembly column: rtr, kit
- power column: electric, nitro
- body column: buggy, truck, monster truck, touring car
Each time a selection is made, the array is filtered out.
-
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’]; -
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’];
-
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’]; -
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.