Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Voting on an ASP page

Reply
Thread Tools

Voting on an ASP page

 
 
Richard Speiss
Guest
Posts: n/a
 
      11-11-2005
I am learning ASP and have my website working pretty well. Now I want to
add a "Surveys" section to it. The format will be something like:

Question 1
Choice 1
Choice 2

Vote
------------
Question 2
Choice 1
Choice 2

Vote

The page will contain more questions as time goes on. Each question and the
choices will come from a database. Each question and each choice has a
unique ID. Each choice will be a radio button

When the user presses the Vote button it needs to pass:
- The ID of the Question
- The ID of the Choice

The update.asp will expect to see the question ID, the choice ID and will
update the database based on that information.

I'm not sure how to go about passing the IDs since they will not be visible
on the webpage.

Am I going about this the right way? Is there a better way?

Any thoughts to point me in the right direction will be most welcome

Richard Speiss




 
Reply With Quote
 
 
 
 
Larry Bud
Guest
Posts: n/a
 
      11-14-2005
> The page will contain more questions as time goes on. Each question and the
> choices will come from a database. Each question and each choice has a
> unique ID. Each choice will be a radio button
>
> When the user presses the Vote button it needs to pass:
> - The ID of the Question
> - The ID of the Choice
>
> The update.asp will expect to see the question ID, the choice ID and will
> update the database based on that information.
>
> I'm not sure how to go about passing the IDs since they will not be visible
> on the webpage.
>
> Am I going about this the right way? Is there a better way?


If you're going to use radio buttons for your voting, you won't have to
pass an ID of the choice. You're going to be passing the choice as the
value of the question.

I.e. Lets say your question ID is 15, and you have 3 choices for the
voting. The HTML would be

First Choice<input type="radio" value="1" name="q_15"><BR>
Second Choice<input type="radio" value="2" name="q_15"><BR>
Third Choice<input type="radio" value="3" name="q_15">

Note that the name of each control is the same, because they are part
of the same group. You will dynamically create the name based on the
ID.

When the form is submitted, you need to iterate through the form since
you don't know waht question IDs to retrieve.. i.e.

for each element in request.form
if left(request.form(element),2)="q_" then
'this is a valid question, process the result here
end if
next

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Voting is an American Privilege; do you plan on exercising that right? Why or Why not ? Sohaib Saleem Computer Support 7 11-03-2008 06:02 AM
Margin of error on ASP voting app dw ASP General 3 08-10-2005 05:55 PM
Internet radio and voting... Mr Bean HTML 1 06-27-2005 10:33 AM
Send a message by voting for Nader Ron Hunter Digital Photography 201 07-05-2004 08:54 PM
Voting Software Needed Matt Silberstein Digital Photography 0 07-04-2004 03:09 PM



Advertisments