Help with Job Posting From plz

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
malakiahs
Forum Newbie
Posts: 13
Joined: Tue Sep 13, 2011 11:15 am

Help with Job Posting From plz

Post by malakiahs »

I ran into a problem and I need help.

I am working with a form using php where users supply information. Its basically a job posting form. I need to post the jobs in another page which will basically be running queries to load these postings.

However, the person filling out the form has the following options as checkboxes.

- I do not want my phone number listed in the posting.

- I do not want my fax number listed in the posting.

- I do not want my e-mail listed in the posting.


Is there a way to post this information so that checked information doesn't show but still be saved in the database using queries?

Thank you in advance.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Help with Job Posting From plz

Post by Celauran »

What's stored in the database and what gets displayed are quite separate. You could have flags in your database table for fields that can be hidden (ie. phone_show) and then display them based on the value of said flag.
malakiahs
Forum Newbie
Posts: 13
Joined: Tue Sep 13, 2011 11:15 am

Re: Help with Job Posting From plz

Post by malakiahs »

Thank you so much for your prompt response. I had not thought of having flags.

I'm not sure if that might bring another problem. I forgot to mention that every postings needs to be viewed by an administrator before it goes public, because postings need to be approved before they actually go public. So basically I'm having two pages where the jobs will be posted.

One page will be public and the other only for the admin with all the columns shown. (The admin page will just be a query of every column with a checkbox to approve it or not )

Will having the flags affect the administrator page? It shouldn't right, I can just ignore the flags for the admin, correct?
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Help with Job Posting From plz

Post by Celauran »

malakiahs wrote:Will having the flags affect the administrator page? It shouldn't right, I can just ignore the flags for the admin, correct?
You don't even need to display them on the administrator page.
malakiahs
Forum Newbie
Posts: 13
Joined: Tue Sep 13, 2011 11:15 am

Re: Help with Job Posting From plz

Post by malakiahs »

So the way I see it is having 3 flag columns in the database with these values

column1 = no_phone_flag = 0 , column2 = no_fax_flag = 0, column3 = no_email_flag = 0

When the user marks a box, the value changes to 1.

Assuming that the user selected not to show phone only
How could I code the query so that when I run something like the following:

$query = SELECT company_name, company_address, (skip company_phone) company_fax, company_email... FROM table1 WHERE no_phone_flag = 1

It doesn't post all jobs without phone numbers of every posting? by using loops?
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Help with Job Posting From plz

Post by Celauran »

Probably the easiest way to do it would be to include the flag columns in your query and choose whether or not to display the associated fields based on their value.

Code: Select all

echo ($row['no_phone'] == 1) ? "" : $row['phone'];
malakiahs
Forum Newbie
Posts: 13
Joined: Tue Sep 13, 2011 11:15 am

Re: Help with Job Posting From plz

Post by malakiahs »

Yes! I can see it now!
Thank you, it is alot less coding your way!!

I really appreciate your help!! I was about to code many ifs and many elseif for all the possible queries....

I appreciate it, you saved me from many lines of unnecessary coding.
Post Reply