I need to figure out a way to get a value from data base. The difficulty is that the query will be based on a form request.
I have a table called VEHICLES. And I need to pull all values using the data from submitted form field of passengers, large_bags, small_bags by visitor.
This table contains different vehicles like a Saloon car which can take up to 4 passengers, 2 large bags and 1 small bag
If a visitor Selects 2 Passengers, 2 Large Bags and 0 Small Bags.
It should only pull the vehicle which can take 2 Passengers, 2 Large Bags.
current code I have is like this which only selects a specific value from the table. It does not
SELECT * FROM vehicles WHERE passengers ='$passengers' AND large_case='$large_bags' AND small_case='$small_bags'
This will only return the value according to what ever the visitor select and because of that 32 Saloon vehicle needs to be created which is not practical.
I need to make a code that calculates the option using the values from the form and pulls only the vehicle which is suitable for the entered value
We have following vehicles;
Salooon => up to 4 Passengers, 2 Large Bags, 1 Small Bag
Estate => up to 4 Passengers, 4 Large Bags or 3 Large bags and 2 Small Bag or 2 Large Bags and 4 Small bags or some other combunations
MPV => Up to 6 Passengers, 3 Large Bags and 2 Small Bags or other combinations
Minibus => Up to 8 Passengers and 10 Large Bags and 5 Small bags or other combinations of large and small bags
Form Entry: 3 Passengers + 3 Large Bags + 2 Small Bags
This should only Return ESTATE.
I hope I could explain enough.