<!--#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 ID,Title,VoteTime,IsSelected
	dim rs,sql
	ID=trim(request("id"))   ' 也可用ID=request("id")
	Title=trim(request.form("Title"))
	IsSelected=int(trim(request("IsSelected")))
	if IsSelected=1 then
		conn.execute "Update Vote set IsSelected=0 where IsSelected=1"
	end if
	dim i
	if ID="" then
		response.write"<script language=JavaScript>alert('非法操作！');"    
		response.write"this.location.href='Vote.asp';</script>"
		response.end
	end if
	sql="select * from Vote where ID="&int(ID)
	Set rs= Server.CreateObject("ADODB.Recordset")
	rs.open sql,conn,1,3
	if not rs.eof then
		if Title<>"" then
			rs("Title")=Title
			for i=1 to 8
				if trim(request("select"&i))<>"" then
					rs("select"&i)=trim(request("select"&i))
					if request("answer"&i)="" then
						rs("answer"&i)=0
					else
						rs("answer"&i)=int(request("answer"&i))
					end if
				else
					rs("select"&i)=""
					rs("answer"&i)=0
				end if
			next
			rs("VoteTime")=now()
			rs("VoteType")=request("VoteType")
			if IsSelected="" then IsSelected=0
			rs("IsSelected")=int(IsSelected)
			rs.update
			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_edit.asp">
        <table width="500" border="0" align="center" cellpadding="0" cellspacing="2" Class="border">
          <tr class="tdbg"> 
						<td width="15%" align="right" bgcolor="#C0C0C0">主题：</td>
						<td width="85%" colspan="3" bgcolor="#E3E3E3"><input name="Title" type="text" value="<%=rs("Title")%>" size="52"></td>
					</tr>
					<% for i=1 to 8%>
					<tr class="tdbg"> 
						<td align="right" bgcolor="#C0C0C0">选项<%=i%>：</td>
						<td bgcolor="#E3E3E3"><input name="select<%=i%>" type="text" value="<%=rs("select"& i)%>" size="36"> 
						</td>
						<td align="right" bgcolor="#E3E3E3">票数：</td>
						<td width="80" bgcolor="#E3E3E3"><input name="answer<%=i%>" type="text" value="<%=rs("answer"&i)%>" size="5"></td>
					</tr>
					<%next%>
					<tr class="tdbg"> 
						<td align="right" bgcolor="#C0C0C0">调查类型：</td>
						<td colspan="3" bgcolor="#E3E3E3"><select name="VoteType" id="VoteType">
							<option value="Single" <% if rs("VoteType")="Single" then %> selected <% end if%>>单选</option>
							<option value="Multi" <% if rs("VoteType")="Multi" then %> selected <% end if%>>多选</option>
						</select></td>
					</tr>
					<tr class="tdbg">
						<td align="right" bgcolor="#C0C0C0">&nbsp;</td>
						<td colspan="3" bgcolor="#E3E3E3">
							<input name="IsSelected" type="checkbox" id="IsSelected" value="1" <% if int(rs("IsSelected"))=1 then response.write "checked"%>>
							设为最新调查</td>
					</tr>
					<tr class="tdbg">
						<td colspan=4 align=center> <BR>
							<input name="ID" type="hidden" id="ID" value="<%=rs("ID")%>"> 
							&nbsp;<input name="Submit" type="submit" id="Submit" value="保存修改结果"> </td>
					</tr>
				</table>
			</form>
		</td>
	</tr>
</table>
<BR>
<%
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
