0

Hi

i have a form which is used to post jobs.
i have multiple checkboxs for location's i need a way in which i can save all the values which are checked into single table or two .

right now i have a table called jobs in which all the jobs ad's will be added.

i need a way which can also help me to create search option as well.

if i create one field in job table called location and save all the check values in it like 1,3,4 then how i create a search query ...

4
Contributors
4
Replies
5
Views
5 Years
Discussion Span
Last Post by diafol
0

Users are only allowed to select one option, Right? if so, then it's easy.

<form action= ""  method="POST"> 

Your checkboxes go here. Users are allowed to choose one option of a few you have given them.
</form>


Inside your action, you put the page that does insertion into your DB.

If this is unclear, please post your code.

0

Personally I would use two tables if you want to be able to easily search. So have your main jobs table and then a second that stores all locations per job (just store job_id and location_id and ensure you can store the job_id multiple times) then you can search this table based on location and grab all the job adverts specific to the location from the main jobs table.

If you store all the locations in one column in your jobs table you will have to serialize the data and then it becomes difficult to search using a query, you would have to grab all data first, unserialize it and then see if the location is in the data.

0

Personally I would use two tables if you want to be able to easily search. So have your main jobs table and then a second that stores all locations per job (just store job_id and location_id and ensure you can store the job_id multiple times) then you can search this table based on location and grab all the job adverts specific to the location from the main jobs table.

If you store all the locations in one column in your jobs table you will have to serialize the data and then it becomes difficult to search using a query, you would have to grab all data first, unserialize it and then see if the location is in the data.

0

DO you have any code of your own to share?
E.g. forms, table structures, sqls ?

Whistling in the dark here mate.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.