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

📄 addnews.asp

📁 自做的购物网站
💻 ASP
字号:
<%
if session("admin_name")="" then response.end
%>
<!--#include file="conn.asp"-->
<!--#include file="css.asp"-->
<%
set rs=server.createobject("adodb.recordset")
if request("action")="save" then
   
    news_title=trim(request("news_title"))
    news_content=trim(request("news_content"))
    if news_title="" or news_content="" then
        response.write "输入数据不能为空"
        response.write "<br>"
        response.write "<a href=addnews.asp>返回</a>"
    else
        news_title=server.htmlencode(news_title)
        news_content=server.htmlencode(news_content)
        news_content=replace(news_content," ","&nbsp;")
        news_content=replace(news_content,chr(13)&chr(10),"<br>")
        sql="select * from news"
        rs.open sql,conn,3,3
        rs.addnew
        rs("news_title")=news_title
        rs("news_content")=news_content
    
        rs.update
        rs.close
        response.write "新闻添加完成"
        response.write "<br>"
        response.write "<a href=addnews.asp>返回"
    end if
else%>
<form method="POST" name="myform" action="addnews.asp?action=save">
  <TABLE cellSpacing=1 cellPadding=0 width="540" align=center bgColor=#999999 
border=0>
    <TBODY> 
    <TR> 
        <TD width="735" background=images/pics/tile_back.gif id=maintitleback> 
          <TABLE cellSpacing=0 cellPadding=3 width="100%" border=0>
            <TBODY>
              <TR> 
                
            <TD width="10"><IMG height=8 src="images/pics/nav_m.gif" width=8 
            border=0></TD>
                
            <TD height="30" valign="bottom" id=maintitle>商品管理 -&gt;<b>添加新闻</b></TD>
              </TR>
            </TBODY>
          </TABLE></TD>
      </TR>
      <TR> 
        <TD id=mainbg> <TABLE cellSpacing=1 cellPadding=4 width="100%" border=0 height="187">
            <TBODY>
              <TR> 
                
            <TD width="100" height="30" noWrap 
          background=images/pics/tile_sub.gif id=titlemedium>
              <div align="center"><font color="#FFFFFF">新闻标题</font></div>
            </TD>
                
            <TD height="30" noWrap 
          background=images/pics/tile_sub.gif id=titlemedium> 
              <div align="left">
                    <input type="text" name="news_title" size="50" class=input>
              </div>
            </TD>
              </TR>
              <TR> 
                <TD height="30" colspan="2" bgColor=#ffffff><div align="center"><img src="../IMAGES/pics/seperator.gif" width="359" height="1"></div></TD>
              </TR>
              <TR> 
                <TD bgColor=#ffffff height="30"><div align="center">新闻内容</div></TD>
                <TD height="30" align=middle bgColor=#ffffff> <div align="left"> 
                    
                <textarea rows="14" name="news_content" cols="60" class=input></textarea>
                  </div></TD>
              </TR>
              <TR> 
                <TD height="30" colspan="2" bgColor=#ffffff><div align="center"><img src="../IMAGES/pics/seperator.gif" width="359" height="1"></div></TD>
              </TR>
              <TR> 
                <TD height="30" colspan="2" bgColor=#ffffff> <div align="center"></div></TD>
              </TR>
              <TR> 
                <TD id=mainfoot 
colSpan=2 height="40"> <div align="center"> 
                    <table width="30%" border="0" align="center" cellpadding="0" cellspacing="0">
                      <tr> 
                        <td><div align="center">
                            <input name=submit2 type=image 
      src="../IMAGES/pics/ok.gif" alt=进入 
      align=absMiddle width="45" height="20" cache tppabs="">
                          </div></td>
                        <td width="50%"><div align="center"> 
                            <input type="reset" value="全部重写" name="B22" class=input>
                          </div></td>
                      </tr>
                    </table>                                 
                  </div></TD>
              </TR>
            </TBODY>
          </TABLE></TD>
      </TR>
    </TBODY>
  </TABLE>
</form>
<%end if
set rs=nothing
conn.close
set conn=nothing
%>

⌨️ 快捷键说明

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