Solved

how make a survey

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Bootstrap Columns not Side-by-Side 3 36
Issue in webpage 6 34
Problem with a CSS in a page 2 26
send keys not working in vba 7 38
Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

911 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

18 Experts available now in Live!

Get 1:1 Help Now