Solved

how make a survey

Posted on 1998-12-19
2
195 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

This article discusses how to create an extensible mechanism for linked drop downs.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

828 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