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

📄 guestbookadd.asp

📁 网站源码
💻 ASP
字号:
<%@ codepage = 936 LCID = 2052 %>
<% if Session("exemple_status") <> "login" then response.redirect "login.asp" %>
<%
Response.expires = 0
Response.expiresabsolute = Now() - 1
Response.addHeader "pragma", "no-cache"
Response.addHeader "cache-control", "private"
Response.CacheControl = "no-cache"
%>
<!--#include file="db.asp"-->

<%
response.buffer = true

'get action
a=request.form("a")

'get fields from form

x_id = Request.Form("x_id")
x_title = Request.Form("x_title")
x_email = Request.Form("x_email")
x_name = Request.Form("x_name")
x_work = Request.Form("x_work")
x_addr = Request.Form("x_addr")
x_content = Request.Form("x_content")
x_datetime = Request.Form("x_datetime")

' Open Connection to the database
set conn = Server.CreateObject("ADODB.Connection")
conn.Open xDb_Conn_Str

Select Case a
	Case "A": ' Add

		' Open record
		strsql = "SELECT * FROM [guestbook] WHERE 0 = 1"

		set rs = Server.CreateObject("ADODB.Recordset")
		rs.Open strsql, conn, 1, 2

		rs.AddNew

		
tmpFld = Trim(x_title)
If trim(tmpFld) & "x" = "x" Then tmpFld = Null
rs("title") = tmpFld
tmpFld = Trim(x_email)
If trim(tmpFld) & "x" = "x" Then tmpFld = Null
rs("email") = tmpFld
tmpFld = Trim(x_name)
If trim(tmpFld) & "x" = "x" Then tmpFld = Null
rs("name") = tmpFld
tmpFld = Trim(x_work)
If trim(tmpFld) & "x" = "x" Then tmpFld = Null
rs("work") = tmpFld
tmpFld = Trim(x_addr)
If trim(tmpFld) & "x" = "x" Then tmpFld = Null
rs("addr") = tmpFld
tmpFld = Trim(x_content)
If trim(tmpFld) & "x" = "x" Then tmpFld = Null
rs("content") = tmpFld
tmpFld = x_datetime
If IsDate(tmpFld) Then
    rs("datetime") = cDate(tmpFld)
Else
    rs("datetime") = Null
End If

		rs.Update
		rs.Close
		Set rs = Nothing
		conn.Close
		Set conn = Nothing
		Response.Clear
		Response.Redirect "guestbooklist.asp"
End Select
%>


<!--#include file="header.asp"-->

<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#336699"><tr><td>
<img src="images/bnradd.gif" alt="" width="400" height="30" border="0"></td></tr></table>

<table width="100%" border="0" cellspacing="0" cellpadding="10"><tr><td>
<p>目前操作栏目 : 客户留言管理<br><br><a href="guestbooklist.asp">[返回上一页]</a></p>

<script language="JavaScript" src="ew.js"></script>
<script language="JavaScript">
<!-- start Javascript
function  EW_checkMyForm(EW_this) {
if  (!EW_hasValue(EW_this.x_title, "TEXT" )) {
            if  (!EW_onError(EW_this, EW_this.x_title, "TEXT", "请输入留言标题!!"))
                return false; 
        }
if  (!EW_hasValue(EW_this.x_name, "TEXT" )) {
            if  (!EW_onError(EW_this, EW_this.x_name, "TEXT", "请输入你的姓名!!!"))
                return false; 
        }
if  (!EW_checkdate(EW_this.x_datetime.value)) {
        if  (!EW_onError(EW_this, EW_this.x_datetime, "TEXT", "Incorrect date (yyyy/mm/dd) - 留言时间"))
            return false; 
        }
return true;
}
// end JavaScript -->
</script>
<form onSubmit="return EW_checkMyForm(this);"  action="guestbookadd.asp" method="post">
<p>
<input type="hidden" name="a" value="A">

<table width="500" border="0" cellspacing="1" cellpadding="5" bgcolor="cccccc">
<tr>
<td bgcolor="f5f5f5"><font color="">id&nbsp;</td>
<td bgcolor="#F5F5F5"><%= x_id %>&nbsp;</td>
</tr>
<tr>
<td bgcolor="f5f5f5"><font color="">标题&nbsp;</td>
<td bgcolor="#F5F5F5"><input type="text" name="x_title" value="<%= x_title %>" size=30 maxlength=50>&nbsp;</td>
</tr>
<tr>
<td bgcolor="f5f5f5"><font color="">电子邮件&nbsp;</td>
<td bgcolor="#F5F5F5"><input type="text" name="x_email" value="<%= x_email %>" size=30 maxlength=50>&nbsp;</td>
</tr>
<tr>
<td bgcolor="f5f5f5"><font color="">姓名&nbsp;</td>
<td bgcolor="#F5F5F5"><input type="text" name="x_name" value="<%= x_name %>" size=30 maxlength=50>&nbsp;</td>
</tr>
<tr>
<td bgcolor="f5f5f5"><font color="">单位&nbsp;</td>
<td bgcolor="#F5F5F5"><input type="text" name="x_work" value="<%= x_work %>" size=30 maxlength=50>&nbsp;</td>
</tr>
<tr>
<td bgcolor="f5f5f5"><font color="">地址&nbsp;</td>
<td bgcolor="#F5F5F5"><input type="text" name="x_addr" value="<%= x_addr %>" size=30 maxlength=50>&nbsp;</td>
</tr>
<tr>
<td bgcolor="f5f5f5"><font color="">留言内容&nbsp;</td>
<td bgcolor="#F5F5F5"><textarea cols=35 rows=4 name="x_content"><%= x_content %></textarea>&nbsp;</td>
</tr>
<tr>
<td bgcolor="f5f5f5"><font color="">留言时间&nbsp;</td>
<td bgcolor="#F5F5F5"><% x_datetime = Date() 'set default value %><input type="text" name="x_datetime" value="<%= x_datetime %>">&nbsp;</td>
</tr>
</table>
<p>
<input type="submit" name="Action" value="ADD">
</form>
</td></tr></table>
<!--#include file="footer.asp"-->

⌨️ 快捷键说明

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