We help IT Professionals succeed at work.
Get Started

multiple url vars to pass

nriddock asked
Last Modified: 2008-07-03
i have a db field called "category" .... category has 5 states: "Open, Closed, Pending, Shipped, Other" .... i am trying to create a search form that will allow the user to use check boxes enabling them to create custom queries based on "category" ....

select * from sales where category=Open or category=Pending...etc.

i can do it in mysql but just can figure out the syntax in php to allow for the fact that they may choose one category or any combination of the 5....any ideas. thx

here's what i have so far...

if (array_key_exists('category', $_REQUEST)) {
$query_Recordset_Sales = "SELECT * from sales  WHERE category = '".addslashes($_REQUEST['category'])."' AND (clientAddress != '') ORDER BY clientAddress DESC";
} else {
Watch Question
This problem has been solved!
Unlock 1 Answer and 6 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE