Hi
I'm still quite new to all this so forgive me if this is really simple - I've also been staring at the problem for waaay too long!
What I've got working so far is a db with job titles and corresponding job descriptions. These job title/descriptions are echoed onto a Current Vacancies page and they appear on an admin page where the client can add a new one, edit or delete existing ones. That all works fine.
What I need to add is a facility where the list of job titles/descriptions on the admin page also has a checkbox next to each item so that if the checkbox is ticked the item appears on the Current Vacancies page. If the checkbox is left unticked then the job doesn't appear rather than the whole lot being listed as it does currently - does that make sense?
I'm a bit lost as to how to get from where I'm at to where I want to be.
Presumably I need to add the checkbox code to the echo bit when the jobs are listed on the admin page. But I'm confused as to what else I need to do.
Thanks for any advice.
Echo data if checkbox checked query
Moderator: General Moderators
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
So are setting this listing up so that the admin's see checkboxes next to all, but users see only the listings that the admins checked?
Simple enough. In your database you need to be able to reference the items that are being checked by the admins. After an admin checks/unchecks a box, the script updates that information in the database (Checkboxes are best stored as boolean values in your DB: Yes/No or 1/0). When the user visits their page the script grabs the data from the database, checks the boolean value of the data in the DB and shows only the 'Yes' or '1' values.
Is that what you are after?
Simple enough. In your database you need to be able to reference the items that are being checked by the admins. After an admin checks/unchecks a box, the script updates that information in the database (Checkboxes are best stored as boolean values in your DB: Yes/No or 1/0). When the user visits their page the script grabs the data from the database, checks the boolean value of the data in the DB and shows only the 'Yes' or '1' values.
Is that what you are after?