ASPAlliance Home
Advertise with us
About Prasad KVNM
Refer this Site
                                               
Home Opinion Poll Sample KV's Kool ASP
Search
Samples/Articles
Convert URLs into Hyperlinks

Advertisement Management Systems

AdRotator Component

Extending AdRotator Component

Simple Alternative to AdRotator

A more powerful Ad Management System

Opinion Poll

Suggestions/Snippets
Passing Special Characters through URL

Date delimiter for Access and SQL Server

CDBL instead of CSNG

Handling Database Errors

Avoid Partial Updates to the Database

Book Review
C# and the .NET Platform

Favorite Links
ASPLists.com
ASPNG.com
Computer Dictionary
LearnASP.com

Microsoft .NET
Search @ Google
Wrox Press
Freecode.com

Site by Prasad KVNM,
New Jersey, USA
prasad@kunisetty.com
last updated on
22nd Oct, 2001



Source Code of poll.asp file:

<!-- Beginning of the ASP -->

<HTML>
<HEAD>
<TITLE>KV's Kool ASP - Opinion Poll Sample</TITLE>

<%

' Declare Variables
' Please note that there is only one data type (and it is called "variant") in ASP; So, there is no need of specifying the data type

Dim question, option1, option2, option3
Dim fileSysObj, tf, pollFile


' Read the Poll Information

' Store the file name where the Poll Information is stored into a variable called pollFile

pollFile = "pollInfo.txt"

' Retrieve the fullpath of the pollFile

pollFile = LEFT(Server.Mappath(Request.ServerVariables("PATH_INFO")), InStrRev(Server.Mappath(Request.ServerVariables("PATH_INFO")), "\")) & pollFile

' Create an instance of FileSystem Object and store it into a variable called fileSysObj

Set fileSysObj = createObject("Scripting.FileSystemObject")

' Check whether the pollFile exists

IF (fileSysObj.FileExists(pollFile)) Then
   
' if the file exists, then open it for reading
    Set tf = filesysobj.OpenTextFile(pollFile, 1)
    question = tf.ReadLine
    option1 = tf.ReadLine
    option2 = tf.ReadLine
    option3 = tf.ReadLine
    tf.Close
ELSE
    ' if the file not exists, take default values
    question = "This is a Sample Poll - and you are requested to participate."
    option1 = "This Sample is Good"
    option2 = "No, this is not Good"
    option3 = "I can't Say"
END IF
%>

</HEAD>
<BODY>
<FONT face="Arial, Helvetica, sans-serif" 
size=2>

<!-- Show the Poll Question -->

<%=question%>

<BR></FONT>

<FORM action="result.asp" method="post">
<INPUT name=RBOptions type=radio 
value="1"> <FONT face="Arial, Helvetica, sans-serif" size=2>

<!-- Show the First Option -->

<%=option1%>

</FONT><BR><INPUT name=RBOptions type=radio value="2"> <FONT 
face="Arial, Helvetica, sans-serif" size=2>

<!-- Show the Second Option -->

<%=option2%>

</FONT><BR><INPUT 
name=RBOptions type=radio value="3"> <FONT 
face="Arial, Helvetica, sans-serif" size=2>

<!-- Show the Third Option -->

<%=option3%>

</FONT><BR><INPUT name=button type=submit value=Vote> </FORM>

</BODY>
</HTML>

<!-- End of the ASP -->



back to Overview

Refer this site ASPAlliance.com |  Contact Us |  Join |  Advertise |  Best Viewed with IE 4.0 or above