On 1 registration page 1.asp, first select town, as follows:
<form action="reguser2.asp" method="post" name="form1" onSubmit="return checksumit();"><table cellpacing="0" cellpadding="0"><tr><td>Town: <%sql="select * from zhen"set rs=server.createobject("adodb.recordset")rs.open sql,conn,3,2%><select name="zhen" id="zhen"><option value=-1>Select town</option><%if rs.eof and rs.bof thenresponse.Write("<option value=-1>No town</option>")elsedo while not rs.eof%><option value="<%=rs("z_id")%>"><%=rs("z_name")%></option> //The value of value and text is obtained in the database, but the variable "zhen" can only get the value of value...How to get the selected text value? <%rs.movenextloopend if%></select></td><tr align="center"><td><input type="submit" name="Submit" value="next" onclick="Javascript:callvalue()"></td> //Step 3, pass to the next page button to add onclick to get the value</tr></table><input type="hidden" name ="sendvalue" /> //Step 1, add a hidden input control here<script language="JavaScript"> //Step 2, write a function to get the text value function callvalue() {sendvalue = document.form1.zhen.item(document.form1.zhen.selectedIndex).text;//alert(sendvalue);document.form1.sendvalue.value = sendvalue;form1.submit();}</script>Finally, in another page 2.asp, the selected text value is directly selected.Form("sendvalue")
In this way, the database can be read infrequently and get the value