CodeAve.com CodeAve.com - ASP - Read/Write
ASP
·Read/Write
·Script Writers
·Database Display
·Response Objects
·Server Variables
·Random Events
·Articles
·Miscellaneous
·Contents
·What's New?
JavaScript
CSS
HTML
Maps
Links
Mail List
Search
Sitemap


 


Vote/User Poll (Without a db)
Polling users is a useful and popular feature on many websites and you do not need a database to track the results. By manipulating text documents on the server you can track users input and display results graphically and the percentages for each vote. Users are only allowed to vote one time per user session to prevent multiple inputs or users who continually hit refresh or reload.
View the Output
Text View
Print View
Mail this Link
Download the Code

<%
on error resume next
u_input=request.form("u_input") %>

<% set fso = createobject("scripting.filesystemobject")
if session("voted_before") = "" then
session("voted_before") = "Yes"
' reads and adds a one to the selected value
g_selected="vote_count"& u_input &".txt"
set act = fso.opentextfile(server.mappath(g_selected))
counter = clng(act.readline)
counter = counter + 1
act.close
Set act = fso.CreateTextFile(server.mappath(g_selected), true)
act.WriteLine(counter)
act.Close
end if
%>




<%
g_selected="vote_counta.txt"
set act = fso.opentextfile(server.mappath(g_selected))
counter_a = clng(act.readline)

%>



<%
g_selected="vote_countb.txt"
set act = fso.opentextfile(server.mappath(g_selected))
counter_b = clng(act.readline)

%>




<%
g_selected="vote_countc.txt"
set act = fso.opentextfile(server.mappath(g_selected))
counter_c = clng(act.readline)

%>



<%
g_selected="vote_countd.txt"
set act = fso.opentextfile(server.mappath(g_selected))
counter_d = clng(act.readline)

%>



<% total=counter_a+counter_b+counter_c+counter_d
%>
<br>


<br>
A&nbsp;<img src="images/red.jpg" height="12" width="<%= (counter_a/total)*100 %>"><%= formatnumber((counter_a/total)*100,1) %>%<br>
B&nbsp;<img src="images/red.jpg" height="12" width="<%= (counter_b/total)*100 %>"><%= formatnumber((counter_b/total)*100,1) %>%<br>
C&nbsp;<img src="images/red.jpg" height="12" width="<%= (counter_c/total)*100 %>"><%= formatnumber((counter_c/total)*100,1) %>%<br>
D&nbsp;<img src="images/red.jpg" height="12" width="<%= (counter_d/total)*100 %>"><%= formatnumber((counter_d/total)*100,1) %>%<br>
Total Votes: <%= total %>

 

 

 



ASP: What's New? | Articles | Script Writers | Database Display | Read/Write
Server Variables | Response Objects | Random Events | Miscellaneous
HTML: Forms | Hyperlinks | Headers | Tables | Hyperlinks | Headers | Text Display
JavaScript: Document Info | Forms | Images | Navigation | Script Writers
CSS: Basics | Page Display | Text Display | Script Writers | Miscellaneous
  • 2014 michael kors
  • air max women 2013
  • 2014 michael kors
  • air max 2014
  • oakley glasses
  • oakley glasses

  • Maps: Map Script Writers | Bing Maps | Google Maps
  • bottes fr
  • ugg boot
  • Privacy Statement

    CodeAve.com is hosted by MyHosting.com
    Donate Food Online with a Mouse Click at TheHungerSite.com
    Donate Land Online with a Mouse Click at TheRainForestSite.com
    © 1999 - 2017 CodeAve.com
    All Rights Reserved

  • Kids jordan 6 rings
  • Jordan retro 10
  • Jordan retro 3