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

📄 add_city.asp

📁 网上学生心里调查系统
💻 ASP
字号:
<!--#include file="config.asp" -->

<%
city=trim(request.form("city"))
pov=trim(request.form("pov"))
quhao=trim(request.form("quhao"))
about=trim(request.form("about"))

set rs=server.CreateObject("adodb.recordset")
if len(city)>0 then
  rs.open"select * from city where 城市='" &city& "' or 区号='" & quhao & "'",conn,1,1
  if not rs.eof then
    response.write "<div align=center><a href='javascript:history.back(1)'>该城市已存在,请重新输入!</a></div>"
    response.end
  end if
  rs.close
  
  rs.open "select * from city",conn,3,3
  rs.addnew
  
  rs("城市")=city
  rs("省份")=pov
  rs("区号")=quhao
  rs("简介")=about
  rs("审核")=-1 '0未审核,-1已审核
  rs("日期")=date()
  
  rs.update
  rs.close
  set rs=nothing
  response.redirect "ok.asp?ok=city"
  response.end
end if
%>

<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name=keywords content="<%=sitekeywords%>">
<meta name="description" content="<%=sitedescription%>">
<title>添加城市 - <%=sitename%></title>
<link href="style.css" rel="stylesheet" type="text/css">
<!--#include file="check.asp" -->
<script language="VBScript">
<!--
''=======================================================''
''函数作用:检测添加城市时的信息是否符合要求
''=======================================================''
function checkaddcity()
if add_city.pov.value="0" then
  msgbox"请输入城市所在省份!"
  add_city.pov.focus
elseif add_city.city.value="" then
  msgbox"请输入城市名称!"
  add_city.city.focus
elseif len(add_city.city.value)>4 then
  msgbox"城市名太长!(4汉字内)"
  add_city.city.focus
elseif Right(add_city.city.value,1)="市" then
  msgbox"城市名称后请不要带“市”!例如北京,请填写“北京”,不要填写“北京市”" 
  add_city.city.value=Replace(add_city.city.value,"市","")
  add_city.city.focus
elseif add_city.quhao.value="" then
  msgbox"请城市电话区号!如北京010"
  add_city.quhao.focus
elseif len(add_city.quhao.value)>4 then
  msgbox"区号太长!(3-4位数字)"
  add_city.quhao.focus
elseif getStrLen(add_city.about.value)>140 then
  msgbox"请输入文字介绍!(70汉字内)"
  add_city.about.focus 
else
add_city.submit
end if
end function
-->
</script>
</head>
<body leftmargin="0" topmargin="2">
<div align="<%=sitealign%>">
<!--#include file="title.asp" -->
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="760" height="80">
  <tr>
    <td class=t1 bgcolor="#88CCFF" align="right"> </td>
    <td class=t1 bgcolor="#88CCFF" align="right">添加城市&nbsp;</td>

  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" style="border:1px solid #88ccff; border-collapse: collapse" width="760">
  <tr>
    <td width="200" bgcolor="#88ccff" valign="top" align="center"><!--#include file="add_left.asp" --></td>
    <td width="560" valign="top">
    <!--表单开始-->
<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse" width="560" height="217">
  <form method="POST" action="add_city.asp" name="add_city">
  <tr>
    <td width="80" align="right" height="40" bgcolor="#EBF4FA">所在省份:</td>
    <td width="480" height="35" bgcolor="#EBF4FA">
      <select size="1" name="pov">
      <option selected value="0">---请选择省份---</option>
      <option value='广东'>广东</option><option value='辽宁'>辽宁</option><option value='江苏'>江苏</option><option value='湖北'>湖北</option><option value='四川'>四川</option><option value='陕西'>陕西</option><option value='河北'>河北</option><option value='山西'>山西</option><option value='河南'>河南</option><option value='吉林'>吉林</option><option value='黑龙江'>黑龙江</option><option value='内蒙古'>内蒙古</option><option value='山东'>山东</option><option value='安徽'>安徽</option><option value='浙江'>浙江</option><option value='福建'>福建</option><option value='湖南'>湖南</option><option value='广西'>广西</option><option value='江西'>江西</option><option value='贵州'>贵州</option><option value='云南'>云南</option><option value='西藏'>西藏</option><option value='海南'>海南</option><option value='甘肃'>甘肃</option><option value='宁夏'>宁夏</option><option value='青海'>青海</option><option value='新疆'>新疆</option><option value='港澳台'>港澳台</option><option value='国外'>国外</option>
      </select>
    </td>
  </tr>
    <tr>
    <td width="80" align="right" height="40">添加城市:</td>
    <td width="480" height="35">
      <input type="text" name="city" size="17" maxlength="4">(4汉字内)</td>
  </tr>
  <tr>
    <td width="80" align="right" height="40" bgcolor="#EBF4FA">城市区号:</td>
    <td width="480" height="35" bgcolor="#EBF4FA">
    <input type="text" name="quhao" size="17" maxlength="4">(该地区电话区号,如北京010)</td>
  </tr>
  <tr>
    <td width="80" align="right" height="80">城市简介:</td>
    <td width="480" height="77">    <textarea rows="4" name="about" cols="45">如果你有本页没有刊登或者刊登错误的本地同志活动场所的最新信息,请告诉我们!</textarea>(70汉字内)</td>
  </tr>
  <tr>
    <td width="80" align="right" height="50" bgcolor="#EBF4FA"></td>
    <td width="480" height="35" bgcolor="#EBF4FA">
    <input type="button" value=" 提 交 " name="add" onclick="checkaddcity()">&nbsp;&nbsp;
    <input type="reset" value=" 重 置 " name="B2"></td>
  </tr></form>
</table>
<!--表单结束-->
    </td>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="760" height="40">
  <tr>
    <td bgcolor="#88CCFF"> </td>
  </tr>
</table>
<!--#include file="copyright.asp" --> 
</div>
</body>
</html>

⌨️ 快捷键说明

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