Howdy!
I need a little help in creating a query for a small search engine for a site I am working on. I have a form that I get my values from. It includes some parameters that will effect the result of my query and I’m a little unsure on how to do it.
I know how to do a basic query i.e.
$sql = "SELECT * FROM jobs WHERE job_title LIKE \"%$_POST['search']%\"";
Even though the above example uses wildcard, it works ok if you are querying one column.
However, I have to make a form that uses checkboxes and other inputs that add to the query and search different columns.
Obviously I’ll need an array something like this:
<input type=“checkbox” name=“sector[]” />
The problem I’m having is adding the checkbox into my query, I’ve noticed that it just adds the last checked value.
I guess I need a foreach loop and conditional statement which adds and breaks up the array into my query.
I’ve been trying to do this for a few hours now, if anyone has any experiance with something I have mentioned could you show me a example or point me in the right direction?
Cheers!