Settig Up a survey system in PHP and mysql.. help needed

I have a site where I survey members from time to time. I want members of certain lists to be directed to a survey page/file. The problem is I need to make sure the survey they are directed to is the one related to their lists and is currently active.

I've set up a survey table where I can add the names of the surveys and file names and even paths and the list Id numbers they are associated with I call that tables Surveys1

The surveys themselves create their own tables and I have code in them that cheks for multiple member entries in the survey tables so I'm fine there. No one will be able to add the form results more than once.

So what I need is a method to show members the right surveys when they log in and click on the survey page. I'm thinking the best way would be to check the database for active surveys for lists  they are members of. The pages already gets their list ID number so its already available as a variable. I could run that against the surveys table and see if there is an active survey and even get the survey file name and location but how would I write that?

How would I direct them to the file name? Would i create a variable out of the survey names or file names of file paths or something? Can a variable be passed in a link?
What should I put in the surveys table to accomplish this?

Thanks for all the help..

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Goodangel MatopeSoftware ArchitectCommented:
You could create a table called "member_lists" in your database which contains the member's id, and the list the are a member of. If  for example, a member with ID 5 is a member of two lists, one with ID 6 and one with ID 7, then you would have two entries in your table, both with ID 5 as the member_id, one having 6 representing the one list and 7 as the list_ID.

When a user clicks on the survey link, you then bring up the survey for the list with the list_id in the member_lists table, by bringing up active survey for the selected list_id

I dont know if this makes sense to you, but it does to me :-)
new_to_phpAuthor Commented:
I have a many to many table already..

How it works is member go to a specific list info page.. it checks to see if they are a member already etc..  what I need is the best way to serve the surveys

I was thinking of querying the survey1 table finding the active list where the list id's match (I already know the member is a member of that list because in order toget this far he'd have to be.

If there is a survey that matches I was think to take the name of the survey and somehoe hand it to an url such as:

I check in the beginning of each survey for duplicate DB entries so II'm not worried about direct accesss etc.

Should I create a variable out of the survey names? Should I store them survey url in the db? Should I simply haven a url that handles the survey variable in the handler page that directs them to the survey?

I'm new to PHP and not sure how to best handle this..



Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.