 |
| Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

December 12th, 2004, 04:20 AM
|
|
Registered User
|
|
Join Date: Dec 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
HELP!! Drop down poll
I need to make a drop down poll. I need to calculate the number of times each option is selected. I can only see the value of the item selected and not of the item previously selected.
<FORM METHOD="POST" ACTION="ProcessVote.asp">
<SELECT NAME="topic">
<OPTION VALUE="INIT">Select your favorite topic</OPTION>
<OPTION VALUE="a">a</OPTION>
<OPTION VALUE="b">b</OPTION>
<OPTION VALUE="c">c</OPTION>
<OPTION VALUE="d">d</OPTION>
</SELECT>
<INPUT TYPE="Submit" VALUE="Vote">
</FORM>
------------------------
'only something like this so far
if Request.Form("topic") <> "INIT" then
Application(Request.Form("topic")) = Application(Request.Form("topic")) + 1
else
Response.Write "You did not make any selection."
end if
|
|

December 12th, 2004, 02:35 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
What exactly are you trying to accomplish? What do you mean with the "previously selected item"?
Do you want the form to automatically submit to the server when you choose a new item from the drop-down?
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

December 12th, 2004, 11:12 PM
|
|
Registered User
|
|
Join Date: Dec 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I want to create a poll with a drop down menu. What I mean is, when I select 'a', I get the number of times 'a' is selected. I do not know how to save this value. When I select 'b', I get the number of times 'b' is selected but cannot track how many time 'a' has already been selected.
Sorry about the cross posting.
Thanks in advance.
|
|

December 12th, 2004, 11:27 PM
|
|
Friend of Wrox
|
|
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
|
|
;;;when I select 'a', I get the number of times 'a' is selected
Do you mean from session to session?
Wind is your friend
Matt
|
|

December 13th, 2004, 03:24 AM
|
|
Registered User
|
|
Join Date: Dec 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I stress that I am very new. I have a rough idea of session but I belief it has nothing to do with it. The big picture is to create a poll. So, basically I want to tabulate the number of times every option is selected. I hope this is crystal clear. Just [u]ignore my previous gibberish..</u>
|
|

December 13th, 2004, 06:32 PM
|
|
Friend of Wrox
|
|
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
|
|
;;;I hope this is crystal clear
Not all that clear
When I say session to session I mean:
1..A user comes to your site (session starts)
2..They choose 'a' in you select box
3..They leave your site (session finishes)
4..Another user comes to your site (another session starts)
5..They also choose 'a'
6..This user leaves your site
7..A third user visits your site (another session starts)
8..While giving this user the option to also make a selection from your select box would you like to show the total number of times each option has been chosen?? For this example it would be:
Welcome to my site, please make a selection
'a' has been chosen 3 times
'b' has been chosen 0 times
....
....
Wind is your friend
Matt
|
|

December 13th, 2004, 09:30 PM
|
|
Registered User
|
|
Join Date: Dec 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Then indeed it is from session to session.
Forgive my ignorance Matt
Meet me at the crossroads
|
|

December 14th, 2004, 08:00 PM
|
|
Friend of Wrox
|
|
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
|
|
;;;Forgive my ignorance Matt
No worries, thats what this place is all about.
What are you doing with your submitted values? I assume they are going into a DB. Lets take your <SELECT NAME="topic"> as an example. If I wanted to track users selections (Poll) I would have a field in a table called 'topic' The value being inserted would be what ever the user selected 'a' or 'b' or 'c'...
Once these are inserted you can run a query something like:
sql = "SELECT count(*) FROM tblName WHERE topic = a;"
set getResults = conn.execute(sql)
The result would be the number of timed 'a' is present, so:
Welcome to my site, please make a selection. FYI a has been selected <%= getResults(0) %> times
Wind is your friend
Matt
|
|

December 14th, 2004, 09:46 PM
|
|
Registered User
|
|
Join Date: Dec 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
That was enlightening but what if I want to immediately tabulate the result on a web page using response.write. Is this even possible without using the DB? Don't bother with the details of tabulating... just to the point where the results a, b, c, d are written on a web page.
I have not started meddling with DB yet. I want to grasp the basics first before going into that.
Another question what's the difference between a normal <script> tag and <% .... %> tags?
Meet me at the crossroads
|
|

December 15th, 2004, 12:58 AM
|
|
Friend of Wrox
|
|
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
|
|
;;; Is this even possible without using the DB
Yes. You need to research the 'Application Object' and 'FileSystem Object'
;;;I have not started meddling with DB yet
Thats what ASP is all about, serving dynamic data.
;;;Another question what's the difference between a normal <script> tag and <% .... %> tags?
<script> = opening tag fro JavaScript </script> = closing
<% = ASP opening tag (all asp is enclosed in these tags) %> = closing
Tip: Get the Wrox book 'beginning ASP' and have a read before you attempt to use the Aplication and Flesystem Ojects
BTW: tabulate, to me means the way in which you would lay results out. Getting and storing the results comes first.
Wind is your friend
Matt
|
Similar Threads
|
| Thread |
Thread Starter |
Forum |
Replies |
Last Post |
| Installation of Opinion Poll |
ssertial |
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 |
0 |
October 26th, 2008 06:35 PM |
| TBH Hosting Poll |
rocco50 |
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 |
7 |
August 26th, 2007 03:12 AM |
| Bug in the Poll VB code? |
thuyvncr |
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 |
2 |
April 21st, 2007 08:43 PM |
| VB .net or ASP(browser based) / suggestion/poll |
iniro |
VB.NET 2002/2003 Basics |
3 |
September 26th, 2004 10:20 PM |
|
 |