Jump to content

Filtering results depending on form results


sonicthehedgehog

Recommended Posts

I'm trying to submit a form is automatically submitted when somebody clicks one of the checkboxes. This part isn't a problem but I'm having a problem with getting the results each time. The form is a series of checkboxes where people can choose to filter results by various options but how do I only get the results if the box is checked?

For example if box a is checked and so is box b I want the results to be something like this:
$sql_select = "SELECT * "; $sql_from = " FROM stock, product_categories, delivery, options "; $sql_where = " WHERE stock.enabled=1 and stock.deleted=0 and stock.dealer_name= delivery.dealer ";$sql_group = " GROUP BY stock.id";$sql_limit = " LIMIT 500"; if ($boxes_group1<>"") {$sql_where = " AND options.category_1 LIKE %box a% %box b%} $query=$sql_select . $sql_from . $sql_where . $sql_end . $sql_group . $sql_limit;
This gives me no results at all even though there are loads of results with box a and also with box b in the category_1 field of the options table.
Also there could be around 20 different options so I need to be able to execute the same code every time regardless of which option is selected
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...