日期:2014-05-17  浏览次数:21011 次

一个初学者简单的问题
<form   method= "post "   action= " "   name=myform>
<table   align= "center "   width= "100 ">
<p   align= "center ">
<tr>
<td   nowrap   width= "100 "   50%   " ">
<input   type= "radio "   name= "elect "   value= "1 "   />   机械工业 </td>
</tr>
<tr>
<td   nowrap   width= "100 "   50%   " ">
<input   type= "radio "   name= "elect "   value= "1 "   />   化学工业 </td> </tr>
<tr>
<td   nowrap   width= "100 "   50%   " ">
<input   type= "radio "   name= "elect "   value= "1 "   />   电子工业 </td> </tr>
<tr>
<td   nowrap   width= "100 "   50%   " ">
<input   type= "radio "   name= "elect "   value= "1 "   />   建筑工业 </td> </tr>
</p>
</table>
<%
if   request.QueryString( "action ")= "submit "   then
      result=request.form( "elect ")
      response.write   result
%>  
<%end   if%>
<p   align= "center ">
<input   type= "submit "   value= "提交 "   name= "submit "   /> &nbsp;&nbsp;
<input   type= "reset "   value= "取消 "   name= "reset "   />
</p>
</form>
<%
result=split(request.form( "elect "), ", ")
for   i=0   to   ubound(result)
response.write   " <div   align=center> "   &result(i)& " <div   align=center> "
response.write   " <br/> "
next  
%>

数据库表表结构
该投票器的连接数据库count.mdb
表名tp
表结构为:
id                 自动编号     编号
question     文本             投票名
ps                 数字             票数

想请教各位大虾,在运行后点击提交把单选框中的value的值导入数据表tp中的ps字段里,受累了,本人刚接触ASP,很多地方都不明白,

------解决方案--------------------
楼主这样做,是无法进行取值的。楼主的意思应该是每选择一个,就把其相应的值加1。哪就下面的方法就可以了.楼主应该保证value里值与外面的选项一样才好。
db= "count.mdb "
connstr= "DBQ= "+server.mappath( " "&db& " ")+ ";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)}; "
set conn=server.createobject( "ADODB.CONNECTION ")
strsql = "update tp set ps=ps+1 where question = ' "&request( "elect ")& " ' "
conn.execte(strsql)
response.write( "投票成功 ")
conn.close()