请问用php怎么遍历页面中表单的每个文本框?
如题,我想实现通过循环获取页面中每个文本框的值,他们的命名是有规则的,不仅是文本框,还有各种单选,多选按钮。我这里有asp的例子,但我不会改,还请各位高人帮帮忙,谢谢!!
for each element in request.form
for i=1 to request.form(element).count
if instr(element,"NO")<>0 then
id=mid(element,3,3)
result=request.form(element)(i)
sql="select * from exam_database where id="& clng(id)
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,3,2
if rs("type")="单选题" then
if result=rs("answer") then
score=score+cint(singleper)
end if
end if
if rs("type")="多选题" then
if instr(rs("answer"),result)<>0 then
score=score+cint(multiper)/4
j=j+1
answer=split(rs("answer"),",")
answercount=ubound(answer)+1
if answercount=j then
score=score+cint(multiper)*(1-j/4)
end if
else
score=score-cint(multiper)/4*(j)
end if
end if
if rs("type")="判断题" then
if rs("answer")=result then
score=score+cint(judgeper)
end if
end if
end if
next
next