Solved

how make a survey

Posted on 1998-12-19
2
164 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
Comment Utility
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
Comment Utility
it sounds really great, but i'm not very sure how to start.
would you please give some sample code?

0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Dynamically changing javascript code 2 43
Library to convert HTML to PDF. 8 44
Menu Inconsistent 3 19
CSS grid style change 2 13
Do you want to insert HTML5 video into your site? This is the tutorial how to do so. What are the main advantages of HTML5 video? 1) Have good compression, good image quality, and low decode processor use. 2) It is royalty-free 3) It is easi…
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 code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …

743 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now