?? admin_addteacher.asp
字號:
<!--#include file="include/conn.asp"-->
<html>
<head>
<link rel="stylesheet" href="inc/css.css" type="text/css" />
</head>
<body>
<form name="form1" method="post" action="">
<table width="550" border=0 align=center cellpadding=2 cellspacing=1 bordercolor="#799AE1" class=tableBorder>
<tbody>
<tr>
<th colspan=7 align=center style="height: 23px">
<div align="center">
添加教師</div></th>
</tr>
<tr bgcolor="#DEE5FA">
<td colspan="7" align="left" bgcolor="#DEE5FA" class=txlrow> </td>
</tr>
<tr align="center" bgcolor="#799AE1">
<td width="68" align="center" bgcolor="#799AE1" class="txlHeaderBackgroundAlternate">
<div align="left">編號</div> </td>
<td width="75" align="center" bgcolor="#799AE1" class="txlHeaderBackgroundAlternate">用戶名</td>
<td width="75" align="center" bgcolor="#799AE1" class="txlHeaderBackgroundAlternate">密碼</td>
<td width="75" align="center" bgcolor="#799AE1" class="txlHeaderBackgroundAlternate">姓名</td>
<td width="75" align="center" bgcolor="#799AE1" class="txlHeaderBackgroundAlternate">性別</td>
<td width="75" align="center" bgcolor="#799AE1" class="txlHeaderBackgroundAlternate">職稱</td>
<td width="90" align="center" bgcolor="#799AE1" class="txlHeaderBackgroundAlternate">所屬學院名稱</td>
</tr>
<tr bgcolor="#DEE5FA">
<td width="36" align="center" class="txlrow"><input name="t_id" type="text" size="4"></td>
<td align="center" bgcolor="#DEE5FA" class="txlrow"><input name="t_usename" type="text" size="10"></td>
<td align="center" bgcolor="#DEE5FA" class="txlrow"><input name="t_password" type="text" size="10"></td>
<td align="center" bgcolor="#DEE5FA" class="txlrow"><input name="t_name" type="text" size="10"></td>
<td align="center" valign="middle" bgcolor="#DEE5FA" class="txlrow"><p>
<label></label>
<select name="sex">
<option>男</option>
<option>女</option>
</select>
</p></td>
<td align="center" bgcolor="#DEE5FA" class="txlrow"><select name="jcheng">
<option>研究生</option>
<option>講師</option>
<option>教授</option>
<option>副教授</option>
<option>博士</option>
</select> </td>
<td align="center" bgcolor="#DEE5FA" class="txlrow">
<select name="institute">
<option selected value="">所有學院</option>
<% dim p
p="select * from institute order by ins_id "
rs.open p,conn,3,3
do while not rs.eof
response.write"<option value="& rs("ins_name")& ">" & rs("ins_name")&"</option>"
rs.movenext
loop
rs.close
set rs=nothing
%>
</select> </td>
</tr>
<tr bgcolor="#DEE5FA">
<td width="36" align="center" class="txlrow"> </td>
<td colspan="6" align="center" bgcolor="#DEE5FA" class="txlrow"><input type="submit" name="Submit" value="確定">
<input type="submit" name="Submit2" value="取消"></td>
</tr>
<tr bgcolor="#DEE5FA">
<td colspan="7" align="left" class="txlrow"><div align="center">
<p> </p>
<table width="545" border="1" align="left" cellpadding="0" cellspacing="0" bordercolor="#ffffff">
<tr>
<td width="35" align="center" bgcolor="#799AE1">編號</td>
<td width="50" align="center" bgcolor="#799AE1">用戶名</td>
<td width="50" align="center" bgcolor="#799AE1">密碼</td>
<td width="60" align="center" bgcolor="#799AE1">姓名</td>
<td width="30" align="center" bgcolor="#799AE1">性別</td>
<td width="50" align="center" bgcolor="#799AE1">職稱</td>
<td width="80" align="center" bgcolor="#799AE1">所屬學院名稱</td>
<td width="60" align="center" bgcolor="#799AE1">編輯</td>
</tr>
<%
dim sql
set rs=server.CreateObject("adodb.recordset")
sql="select * from teacher order by ID"
rs.open sql,conn,1,1
do while not rs.eof
%>
<tr align="center">
<td height="10" align="center" width="35" ><% =rs("t_id") %> </td>
<td height="10" align="center" width="50"><% =rs("t_usename") %> </td>
<td height="10" align="center" width="50"><% =rs("t_password") %> </td>
<td height="10" align="center" width="60"><% =rs("t_name") %> </td>
<td height="10" align="center" width="30"><% =rs("t_sex") %> </td>
<td height="10" align="center"><% =rs("t_jcheng") %> </td>
<td height="10" align="center" width="100"><% =rs("ins_name") %> </td>
<td align="center" width="60"> <a href="admin_editerteacher.asp?id=<%=rs("ID")%>">修改</a> <a href="DELETE_tea.asp?id=<%=rs("ID")%>">刪除</a></div></td>
</tr>
<%
rs.movenext
loop
rs.close
set rs=nothing
%>
</table>
</div></td>
</tr>
<tr bgcolor="#DEE5FA">
<td colspan=7 align=center class=txlrow></td>
</tr>
</tbody></table>
</FORM>
<%
dim s,t_id,usename,paw,t_name,t_sex,t_jcheng,t_ins
t_id=request.form("t_id")
paw=request.form("t_password")
usename=request.form("t_usename")
t_name=request.form("t_name")
t_sex=request.form("sex")
t_jcheng=request.form("jcheng")
t_ins=request.form("institute")
if request.form("submit")="確定" then
if t_id="" or paw="" or usename="" or t_name="" or t_sex="" or t_jcheng="" or t_ins="" then
response.write "<script> alert('輸入框不能留空!');history.go(-1);</script>"
else
set rs=server.CreateObject("adodb.recordset")
s="select * from teacher where t_id='"&t_id&"'"
rs.open s,conn,3,3
if not rs.eof then
response.write "<script> alert('該教師編號已經存在!');history.go(-1);</script>"
else
rs.addnew
rs("t_id")=t_id
rs("t_password")=paw
rs("t_usename")=usename
rs("t_name")=t_name
rs("t_sex")=t_sex
rs("t_jcheng")=t_jcheng
rs("ins_name")=t_ins
rs.update
response.write "<script> alert('添加成功!');history.go(-1);</script>"
end if
rs.close
set rs=nothing
end if
end if
%>
</BODY>
</HTML>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -