<!--#include file="conn.asp"-->
<!--#include file="check.asp"-->
<%
	useflag=1
%>
<!--#include file="flag.asp"-->
<!--#include file="../inc/setup.asp"-->
<!--#include file="../inc/sql.asp"-->
<%
	end if
	dim Title,VoteTime,Action,IsSelected
	dim rs,sql
	Title=trim(request.form("Title"))
	IsSelected=int(Trim(Request.Form("IsSelected")))
	if IsSelected="" then IsSelected=0
	if IsSelected=1 then conn.execute "Update Vote set IsSelected=0 where IsSelected=1"
	dim i
	if Title<>"" then
		sql="select * from Vote"
		Set rs= Server.CreateObject("ADODB.Recordset")
		rs.open sql,conn,2,3
		rs.addnew
		rs("Title")=Title
		for i=1 to 8
			if trim(Request.Form("select"&i))<>"" then
				rs("select"&i)=trim(Request.Form("select"&i))
				if Request.Form("answer"&i)="" then
					rs("answer"&i)=0
				else
					rs("answer"&i)=int(Request.Form("answer"&i))
				end if
			end if
		next
		rs("VoteTime")=now()
		rs("VoteType")=Trim(Request.Form("VoteType"))
		rs("IsSelected")=int(IsSelected)
		rs.update
		rs.close
		set rs=nothing
		conn.close
		set conn=nothing
		response.write"<script language=JavaScript>alert('投票项目增加成功！');"    
		response.write"this.location.href='Vote.asp';</script>"
		response.end
	end if
%>
<html>
<head>
<title>网愿科技</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="Include/ManageMent.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--

.a1{BACKGROUND-IMAGE:url('images/titlebg.gif');COLOR:000000;}
.a2{BACKGROUND-COLOR: A4B6D7;}
.a3{BACKGROUND-COLOR: F2F8FF;}
.a4{BACKGROUND-COLOR: ECF5FF;}

.t1 {font:12px 宋体;color:#000000} 
.t2 {font:12px 宋体;color:#ffffff} 
.t3 {font:12px 宋体;color:#ffff00} 
.t4 {font:12px 宋体;color:#800000} 
.t5 {font:12px 宋体;color:#191970} 

.aaa:hover{
	Font-unline:yes;
	font-family: "宋体";
	color: #FFFFFF;
	text-decoration: underline;
	background-color: #CCCCCC;
}

-->
</style>
</head>
<body>
<BR>
<table cellpadding="2" cellspacing="1" border="0" width="560" align="center" class="a2">
	<tr>
		<td class="a1" height="25" align="center"><strong>添 加 调 查</strong></td>
	</tr>
	<tr class="a4">
		<td align="center">
      <br>
			<form method="POST" action="Vote_Add.asp">
        <table width="500" border="0" align="center" cellpadding="0" cellspacing="2" Class="border">
          <tr class="tdbg"> 
            <td width="81" height="22" align="right" bgcolor="#C0C0C0">主题：</td>
            <td colspan="3" bgcolor="#E3E3E3">
							<input name="Title" type="text" size="45" maxlength="50"></td>
					</tr>
<% for i=1 to 8%>
					<tr class="tdbg"> 
            <td height="22" align="right" bgcolor="#C0C0C0">选项<%=i%>：</td>
            <td width="281" bgcolor="#E3E3E3">
							<input type="text" name="select<%=i%>" size="36"></td>
            <td width="41" align="right" bgcolor="#E3E3E3">票数：</td>
            <td width="87" bgcolor="#E3E3E3">
							<input type="text" name="answer<%=i%>" size="5"></td>
					</tr>
<%next%>
				  <tr class="tdbg"> 
            <td height="22" align="right" bgcolor="#C0C0C0">调查类型：</td>
            <td colspan="3" bgcolor="#E3E3E3">
						<select name="VoteType" id="VoteType">
							<option value="Single" selected>单选</option>
							<option value="Multi">多选</option>
						</select></td>
					</tr>
					<tr class="tdbg">
            <td height="22" align="right" bgcolor="#C0C0C0">&nbsp;</td>
            <td colspan="3" bgcolor="#E3E3E3">
							<input name="IsSelected" type="checkbox" id="IsSelected" value="1" checked>
							设为最新调查</td>
					</tr>
					<tr class="tdbg"> 
            <td height="25" colspan=4 align=center><BR>
              <input name="Submit" type="submit" id="Submit" value=" 添 加 "> 
							&nbsp; <input  name="Reset2" type="reset" id="Reset2" value=" 清 除 "> </td>
					</tr>
				</table>
			</form>
		</td>
	</tr>
</table>
<BR>
</body>
</html>

