⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 admin_question_add.asp

📁 Build 1025更新: 美化了后台,简化了后台操作
💻 ASP
字号:
<!--#include file="conn.asp"-->
<!--#include file="check.asp"-->
<html>

<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>■管理中心</title>
<link rel="stylesheet" type="text/css" href="Admin_STYLE.CSS">
</head>

<body topmargin="1" leftmargin="1">

<div align="center">
	<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" id="table1" bgcolor="#E1F4EE" bordercolor="#009286">
		<tr>
			<td bgcolor="#009286"><font color="#FFFFFF"><b>添加投票问题-&gt;</b></font></td>
		</tr>
		<tr>
			<td>
			<div align="center">
				<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="50%" id="table2" bordercolor="#FFFFFF">
<%
if Request("act") = "step1" then
	dim Subject,sid
	sid = Request.Form("sid")
	if sid = "" then
		Response.Write "<script>alert('请先添加投票主题!');history.back(1)</script>"
	End if
		
	Set rs = Server.CreateObject("ADODB.RecordSet")
	rs.Open "Select subject from XH_Subject where id=" & Request.Form("sid"),conn,1,1
	if not(rs.Eof and rs.Bof) then
		Subject = rs("subject")		
	End if
	rs.Close
	Set rs = Nothing
	
	Call step2()
Elseif Request("act") = "step2" then
	dim tid,Title
	sid = Request.Form("sid")
	tid = Request.Form("tid")
	Subject = Request.Form("subject")
	
	if sid = "" then
		Response.Write "<script>alert('请先选择投票主题!');history.back(1)</script>"
	End if
	if tid = "" then
		Response.Write "<script>alert('请先添加投票主题!');history.back(1)</script>"
	End if
	
	Set rs = Server.CreateObject("ADODB.RecordSet")
	rs.Open "Select title from XH_Title where id=" & Request.Form("tid"),conn,1,1
	if not(rs.Eof and rs.Bof) then
		Title = rs("title")
	End if
	rs.Close
	Set rs = Nothing
	
	Call step3()
Elseif Request("act") = "step3" then
	dim Question,ps
	sid = Request.Form("sid")
	tid = Request.Form("tid")
	Question = Request.Form("question")
	ps = Request.Form("ps")
	if sid = "" then
		Response.Write "<script>alert('请先选择投票主题!');history.back(1)</script>"
	End if
	if tid = "" then
		Response.Write "<script>alert('请先选择投票主题!');history.back(1)</script>"
	End if
	if Question = "" then
		Response.Write "<script>alert('问题不能为空!');history.back(1)</script>"
	End if
	if IsNumeric(ps) = false then
		Response.Write "<script>alert('票数必须为数字!');history.back(1)</script>"
	End if	
	
	Conn.Execute("insert into XH_Question (question,sid,tid,ps) values ('" & Question &"'," & sid &"," & tid &"," & ps &")")
	Conn.Close
	
	Response.Write "<script>alert('添加投票问题成功!');location.href='admin_question_add.asp'</script>"
Else
	Call step1()
End if					
%>

					<%Sub step1()%>
					<form action="?act=step1" method="post" name="form1">
						<tr>
							<td align="center" colspan="2"><b>请选择投票主题</b></td>
						</tr>
						<tr>
							<td align="center" colspan="2">
							<select name="sid">
							<%
							dim srs
							set srs=server.createobject("adodb.recordset")
							srs.open "select * from XH_Subject order by id desc",conn,1,1
							if not (srs.eof and srs.bof) then
								do while not srs.eof
							%>
							<option value="<%=srs("id")%>"><%=srs("subject")%></option>
							<%
								srs.movenext
								loop
							end if
							srs.close
							set srs=nothing
							%>		
							</select></td>
						</tr>
						<tr>
							<td align="center" colspan="2">
							<input type="submit" name="submit" value="下一步"></td>
						</tr>
					</form>
					<%
					End Sub
					Sub step2()
					%>
					<form action="?act=step2" method="post" name="form2">	
						<tr>
							<td align="center" colspan="2"><b>请选择投票标题</b></td>
						</tr>
						<tr>
							<td width="40%" align="right">所属主题名称:</td>
							<td><%=Subject%><input type="hidden" name="sid" value="<%=Request.Form("sid")%>"><input type="hidden" name="subject" value="<%=Subject%>"></td>
						</tr>
						<tr>
							<td align="center" colspan="2">
							<select name="tid" size="1">
							<%
							dim trs
							set trs=server.createobject("adodb.recordset")
							trs.open "select * from XH_Title where sid=" & Request.Form("sid") &" order by id asc",conn,1,1
							if not (trs.eof and trs.bof) then
								do while not trs.eof
							%>
							<option value="<%=trs("id")%>"><%=trs("title")%></option>
							<%
								trs.movenext
								loop
							end if
							trs.close
							set trs=nothing
							%>		
							</select></td>
						</tr>
						<tr>
							<td align="center" colspan="2">
							<input type="button" name="button1" value="上一步" onclick="javascript:window.history.back(1)">&nbsp;<input type="submit" name="submit" value="下一步"></td>
						</tr>
					</form>	
					<%
					End Sub
					Sub step3()
					%>
					<form action="?act=step3" name="form3" method="post">
						<tr>
							<td align="center" colspan="2"><b>设置投票问题</b></td>
						</tr>
						<tr>
							<td width="40%" align="right">所属主题名称:</td>
							<td><%=Subject%></td>
						</tr>
						<tr>
							<td width="40%" align="right">所属投票标题:</td>
							<td><%=Title%></td>
						</tr>
						<tr>
							<td width="40%" align="right">投票问题名称:</td>
							<td><input type="text" name="question" size="25"><input type="hidden" name="sid" value="<%=Request.Form("sid")%>"><input type="hidden" name="tid" value="<%=Request.Form("tid")%>"></td>
						</tr>
						<tr>
							<td width="40%" align="right">票数:</td>
							<td><input type="text" name="ps" size="5" value="0"></td>
						</tr>
						<tr>
							<td colspan="2" align="center">
							<input type="button" name="button2" value="上一步" onclick="javascript:window.history.back(1)">&nbsp;<input type="submit" name="submit" value=" 完 成 "></td>
						</tr>
					</form>
					<%
					End Sub
					%>
				</table>
			</div>
			</td>
		</tr>
	</table>
</div>

</body>

</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -