Link to home
Start Free TrialLog in
Avatar of new_to_php
new_to_php

asked on

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..


Avatar of Goodangel Matope
Goodangel Matope
Flag of Zambia image

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 :-)
ASKER CERTIFIED SOLUTION
Avatar of new_to_php
new_to_php

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial