Dav jeg har en Poll der ser således ud!:
<%
' --------------------------------------------------------------
' Function Stem(id) - id = id i stem.mdb
' --------------------------------------------------------------
function stem(id)
font = "<font size='1' face='Verdana'>"
faktor = 1
barcolor = "#D2BC86"
Set RsVote = Server.CreateObject("ADODB.Connection")
DBPath = "DBQ=" & server.mappath("stem.mdb")
RsVote.Open "DRIVER={Microsoft Access Driver (*.mdb)}; " &
DBPath
Sql = "Select * from T_Vote where Id = " & id
Set Record = RsVote.Execute(Sql)
If Not Record.EOF then
If (Len(Request.Cookies("stem")(CSTR(id)))) then
Dim Valg(5)
valg(1) = Record("valg1")
valg(2) = Record("valg2")
valg(3) = Record("valg3")
valg(4) = Record("valg4")
valg(5) = Record("valg5")
response.write font & Record("Beskrivelse") & "<br><br>"
Sql = "Select count(*) as Found from T_VoteResult where
VoteId = " & id
Set Record = RsVote.Execute(Sql)
Ialt = Record("found")
Response.Write "<div align='left'><table width='120'
border='0'><tr>"
For i = 1 to 5
If valg(i) <> "" then
Sql = "Select count(*) as Found from T_VoteResult where
VoteId = " & id & " and vote = '" & Valg(i) & "'"
Set Record = RsVote.Execute(Sql)
Procent = 100/Ialt * Record("Found")
response.write "<td>" & font & Valg(i) & " <b>" &
font & Round(procent) & "%</b></td></tr><td><hr width='" &
Procent * faktor & "' size='10' align='left' color='" & barcolor
& "'></td></tr>"
end if
Next
Response.Write "</table></div>"
else
session("retur") = Request.ServerVariables("SCRIPT_NAME")
response.write font & Record("Beskrivelse")
response.write
"<html><head><title>Stem</title></head><body>"
response.write "<form method='POST' action='stemreg.asp'>"
response.write "<input type='hidden' name='Voteid' value="
& Id & ">"
If Record("Valg1") <> "" then
response.write "<input type='radio' value='" &
Record("Valg1") & "' name='R1'>" & Record("Valg1") & "<br>"
end if
If Record("Valg2") <> "" then
response.write "<input type='radio' value='" &
Record("Valg2") & "' name='R1'>" & Record("Valg2") & "<br>"
end if
If Record("Valg3") <> "" then
response.write "<input type='radio' value='" &
Record("Valg3") & "' name='R1'>" & Record("Valg3") & "<br>"
end if
If Record("Valg4") <> "" then
response.write "<input type='radio' value='" &
Record("Valg4") & "' name='R1'>" & Record("Valg4") & "<br>"
end if
If Record("Valg5") <> "" then
response.write "<input type='radio' value='" &
Record("Valg5") & "' name='R1'>" & Record("Valg5") & "<br>"
end if
response.write "<p> <input type='submit' value='Stem'
name='B1'> <input type='reset' value='Slet'
name='B2'></p>"
response.write "</form></body></html>"
end if
else
response.write font & "Id findes ikke!!!"
end if
end function
%>
Men jeg kan ikke få den til at vise hvor mange der har stemt...
Hvad skal jeg gøre?
--
Vil du lære at kode HTML, XHTML, CSS, SSI eller ASP?
- Pædagogiske tutorials på dansk
- Kom godt i gang med koderne
KLIK HER! =>
http://www.html.dk/tutorials