Skip to content

Instantly share code, notes, and snippets.

@ryanpitts
Created August 22, 2011 22:08
Show Gist options
  • Save ryanpitts/1163757 to your computer and use it in GitHub Desktop.
Save ryanpitts/1163757 to your computer and use it in GitHub Desktop.
<%
q1 = request.querystring("q1")
q2 = request.querystring("q2")
q3 = request.querystring("q3")
q4 = request.querystring("q4")
q5 = request.querystring("q5")
q6 = request.querystring("q6")
q7 = request.querystring("q7")
q8 = request.querystring("q8")
q9 = request.querystring("q9")
c = request.querystring("c")
d = request.querystring("d")
e = request.querystring("e")
k = request.querystring("k")
u = request.querystring("u")
l = request.querystring("l")
s = request.querystring("s")
myval = ""
If c = "on" Then myval = myval & "c"
If d = "on" Then myval = myval & "d"
If e = "on" Then myval = myval & "e"
If k = "on" Then myval = myval & "k"
If u = "on" Then myval = myval & "u"
If l = "on" Then myval = myval & "l"
If s = "on" Then myval = myval & "s"
q10 = myval
mystring = q1 & q2 & q3 & q4 & q5 & q6 & q7 & q8 & q9 & q10
function str_count(string, substring)
':: count the occurences of a substring within a string
str_count = UBound(split(string, substring))
end function
if mystring <> "" then
cclark = str_count(mystring,"c")
cdean = str_count(mystring,"d")
cedwards = str_count(mystring,"e")
ckerry = str_count(mystring,"k")
ckucinich = str_count(mystring,"u")
clieberman = str_count(mystring,"l")
csharpton = str_count(mystring,"s")
else
cclark = 0
cdean = 0
cedwards = 0
ckerry = 0
ckucinich = 0
clieberman = 0
csharpton = 0
end if
fArray = array(q1,q2,q3,q4,q5,q6,q7,q8,q9,q10)
for x = 0 to ubound(fArray, 1)
num = x+1
if num = 10 then num = 0
'clark
if instr(fArray(x),"c") <> 0 then
yclark = yclark & num
else
nclark = nclark & num
end if
'dean
if instr(fArray(x),"d") <> 0 then
ydean = ydean & num
else
ndean = ndean & num
end if
'edwards
if instr(fArray(x),"e") <> 0 then
yedwards = yedwards & num
else
nedwards = nedwards & num
end if
'kerry
if instr(fArray(x),"k") <> 0 then
ykerry = ykerry & num
else
nkerry = nkerry & num
end if
'kucinich
if instr(fArray(x),"u") <> 0 then
ykucinich = ykucinich & num
else
nkucinich = nkucinich & num
end if
'lieberman
if instr(fArray(x),"l") <> 0 then
ylieberman = ylieberman & num
else
nlieberman = nlieberman & num
end if
'sharpton
if instr(fArray(x),"s") <> 0 then
ysharpton = ysharpton & num
else
nsharpton = nsharpton & num
end if
next
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=windows-1252">
<title>Campaign 2004 candidate matcher :: spokesmanreview.com</title>
<link rel="stylesheet" type="text/css" href="/design/blogs/control/layout.css" />
</head>
<body>
<div id="header">
<div class="pagelabel">
<a href="/"><img src="/design/forums/media/srlogo.gif" width="200" align="right" border="0" alt="spokesmanreview.com"></a>
<a href="/" title="spokesmanreview.com">spokesmanreview.com</a>
</div>
<div class="doublerule"></div>
<div class="blogtitle" valign="middle"><a href="/quiz" title="survey results cover">Campaign 2004 Democratic issues quiz</a></div>
</div>
<table width=750 cellpadding=1 cellspacing=0 align="center">
<tr>
<td valign="top"><br />
<h1>You're done!</h1>
<p><b>Here are your results ...</b></p><br />
<p>
You agreed with Wesley Clark on <a href="clark.asp?y=<% = yclark %>&n=<% = nclark %>"><b><% = cclark %></b> of the 10 issues</a>.<br />
You agreed with Howard Dean on <a href="dean.asp?y=<% = ydean %>&n=<% = ndean %>"><b><% = cdean %></b> of the 10 issues</a>.<br />
You agreed with John Edwards on <a href="edwards.asp?y=<% = yedwards %>&n=<% = nedwards %>"><b><% = cedwards %></b> of the 10 issues</a>.<br />
You agreed with John Kerry on <a href="kerry.asp?y=<% = ykerry %>&n=<% = nkerry %>"><b><% = ckerry %></b> of the 10 issues</a>.<br />
You agreed with Dennis Kucinich on <a href="kucinich.asp?y=<% = ykucinich %>&n=<% = nkucinich %>"><b><% = ckucinich %></b> of the 10 issues</a>.<br />
<!--
You agreed with Joe Lieberman on <a href="lieberman.asp?y=<% = ylieberman %>&n=<% = nlieberman %>"><b><% = clieberman %></b> of the 10 issues</a>.<br />
-->
You agreed with Al Sharpton on <a href="sharpton.asp?y=<% = ysharpton %>&n=<% = nsharpton %>"><b><% = csharpton %></b> of the 10 issues</a>.<br />
</p><br />
<br /><br />
</td>
</form>
</tr>
</table>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment