Solved

how make a survey

Posted on 1998-12-19
2
185 Views
Last Modified: 2010-04-09
this is what i am trying to do:
i've a list of 100 items. in my homepage, i would like
my visitors to vote only one item at one time. it would be
ideal if i can make the list in a form of pull down dialog box. is it possible to limit them so that one ip address will be recorded once within 6 hours no matter how many time it votes?  this is basically what i want.  but i can give more points if the result can be analysis, ie i want to know which one has the highest score etc.
0
Comment
Question by:roylam
2 Comments
 
LVL 6

Accepted Solution

by:
PBall earned 350 total points
ID: 1840821
I have done something similar in a form of a game using ASP.
Instead of using IP address I use a login system.  Each player can only play once every 12 hours since their last entry.

I'd imagine that using ip won't be too difficult since you might be able to get that from the server variables (I might be wrong since I don't use that too much).

Depending whether or not you want the same ip to be able to answer the same question again and again or not, different method can be implemented.

1. if it does matter,
create a table with ip address, last timestamp, and n bit fields (where n = number of questions).  This might not be the best table, but it will work for now, for future use you might want to separate it into two table and relate them to each other.

2. if it does not matter,
create a table with ip address, last timestamp only

now, on the initial page (before you show the question), execute a function that can detect the ip address, check that ip vs the table, if it exist, check the last timestamp and compare it with current time, if greater than or equal to 6, replace the timestamp with current time and generate a question number randomly and show the question (remember to pass the question number to a hidden form field for post processing).

Upon answering the question, your cgi script then can retrieve the question number from the hidden field and do whatever you want with it.  For example if each question is a multiple choice, and you have a question table like:

q.id
q.questiontext
q.answer1
q.answer2
q.answer3
:
q.answern

you might want to match each answer with a
q.answer1_freq (for the number of times this answer was given, etc.) Again this might not be the best way to layout the table, I hope you are familiar w/ table normalization.

If q.answer1 was given, update q.answer1_freq to include the new response (q.answer1_freq++)
etc. etc.

I hope I've given you enough info for you to start coding this thing :)

Good nuff?
0
 

Author Comment

by:roylam
ID: 1840822
it sounds really great, but i'm not very sure how to start.
would you please give some sample code?

0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Someone recently asked me about how to display a progress indicator on a page while an iframe is loading. And I remember when I first came across this myself. It was a bit tricky to get my head around, but really, it's very simple. The most impor…
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question