Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

voting poll

Status
Not open for further replies.

Herminio

Technical User
May 10, 2002
189
PT
I'm building a site for polls, i'd like to know how do i update the database with radiobuttons, the possible answers have radiobuttons to choose from and i can't make the update query to work, i know that all the radiobuttons must have the same name, but waht about the values, i want the fields in the DB to be increased by one depending of what radiobutton is choosed.

Thanks in Advance

Herminio, Portugal
 
html form:

<form name=&quot;vote&quot; method=&quot;post&quot; action=&quot;vote.asp&quot;>
<input type=&quot;radio&quot; name=&quot;vote&quot; value=&quot;yes&quot;>Yes<br>
<input type=&quot;radio&quot; name=&quot;vote&quot; value=&quot;no&quot;>No<br>
<input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;Vote&quot;>
</form>

vote.asp page:

<%
dim strVote
strVote = Request.Form(&quot;vote&quot;)
If strVote <> &quot;&quot; Then
If strVote = &quot;yes&quot; Then
strSQL = &quot;UPDATE sometable SET voteyes = voteyes + 1;&quot;
Else
strSQL = &quot;UPDATE sometable SET voteno = voteno + 1;&quot;
End If
set objConn = Server.CreateObject(&quot;ADODB.Connection&quot;)
objConn.Open &quot;some connection string&quot;
set objCmd = Server.CreatObject(&quot;ADODB.Command&quot;)
With objCmd
.ActiveConnection = objConn
.CommandText = strSQL
.CommandType = adCmdText
.Execute
End With
set objCmd = nothing
objConn.Close
set objConn = nothing
End If %>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top