How can we filter categories (checkbox) like this: http://tp.jobscentral.com.sg/pubsearchjobs.php

Recommended Answers

All 3 Replies

Member Avatar for diafol

Have you checked the view-source?
They use the same name for all checkboxes and apply a numerical value to each based on the 'id' of the category in the DB.
So the $_POST variable will contain an array of values. You then need to either loop through this array OR create a comma separated list from this array to use in your SQL statement (hint - you'll need to use the IN keyword in the WHERE clause).

thanks for your help ardav. greatly appreciated (:
i encounter another problem. now my job posting system can only post 1 job for a user. any idea what's the problem or any suggestions?

Member Avatar for diafol

Where is the problem? With the post variable or with your database field?

Your DB should have a structure something like:

user
id (PK)
username
...etc...

jobs
id (PK)
job_title

user_jobs
id (PK)
user_id (Foreign Key on user.id)
job_id (Foreign Key on jobs.id)

(This last table could be v.big, but that's OK, e.g. 30 jobs for each user. Even if you've got 10,000 users, that's still only 300,000 records - nothing for mysql)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.