ASP advanced article Online Management update (11)

Source: Internet
Author: User
Tags include modify microsoft frontpage
Online ASP Advanced article online Management Update--the article modified article

Author: Beach Boy

In the last section we talked about the implementation of the online deletion of the article, here I will introduce you to the online modification of the article management system. In this system, the provision of online modification is an essential content, because when you update the article on the Internet, always encounter such a problem, a careless will cause the error of adding, sometimes the content is not complete, there may be the column of the article originally added when the wrong choice, At the same time it is such a mistake to appear the necessity of this procedure.

The article's online modification saves the program actually and the article adds and saves the program to be similar, it's just that the database is being updated and the article is adding a new record for the database, but it's pretty much the same in general, so here I'm just commenting on the different points of those two programs, Other if there's something you don't understand, take a look at section second to third of this topic, and let's introduce the process of implementing this feature:

(1). File edit.asp, this file has nothing to speak of, because basically and the system addarticle.asp program is the same, only in the article title and content part of the article took the corresponding database content, in order to facilitate reference modification.
<!--#include file= "conn.asp"-->
<%
If Request.Cookies ("Adminok") = "" Then
Response.Redirect "Login.asp"
End If
%>

<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<meta name= "generator" content= "Microsoft FrontPage 3.0" >
<link rel= "stylesheet" type= "Text/css" href= "Style.css" >
<title> Modify Articles </title>

<body>

<form method= "POST" action= saveedit.asp?id=<%=request ("id")%> ">
<div align= "center" ><center><table border= "1" cellspacing= "0" width= "80%" bordercolorlight= "#000000" bordercolordark= "#FFFFFF" cellpadding= "0" >
<tr>
&LT;TD width= "100%" bgcolor= "#D0D0D0" height= "" ><div align= "Center" ><center><p><b> amendment Chapter </b></td>
</tr>
&LT;TR align= "center" >
&LT;TD width= "100%" ><table border= "0" cellspacing= "1" width= "100%" >
<%
Dim sql
Dim rs
Sql= "SELECT * from article where articleid=" &request ("id")
Set Rs=server.createobject ("Adodb.recordset")
Rs.Open sql,conn,1,1
%>
<tr>
&LT;TD width= "15%" align= "right" height= "a" ><b> article title:</b></td>
&LT;TD width= "85%" height= "><input type=" text "name=" Txttitle "size=" 70 "
class= "Smallinput" maxlength= "value=" <%=rs ("title")%> "></td>
</tr>
<tr>
&LT;TD width= "15%" align= "right" valign= "top" ><b> article content:</b></td>
&LT;TD width= "><textarea rows=" name= "txtcontent" cols= "85%" class= "Smallarea" ><%content=replace ( RS ("content"), "<br>", Chr (13))
Content=replace (Content, "", "")
Response.Write content%></textarea></td>
</tr>
<tr>
&LT;TD width= "15%" align= "right" valign= "top" height= "></td>"
&LT;TD width= "85%" ></td>
</tr>
</table>
</td>
</tr>
</table>
</center></div><div align= "center" ><center><p><input type= "Submit" value= "Modify"
Name= "Cmdok" class= "ButtonFace" > <input type= "reset" value= "recovery"
Name= "Cmdcancel" class= "ButtonFace" ></p>
</center></div>
</form>
</body>
<%
Rs.close
Set rs=nothing
Conn.close
Set conn=nothing
%>

(2). File saveedit.asp, the save modification file here is similar to the one in the article, except that it is updated on the database, while the save in the added article is to add a new record to the database operation.

The Open database connection
<!--#include file= "conn.asp"-->
"Open the code for the content of the article to convert the file
<!--#include file= "Inc/articlechar.inc"-->
<%
If Request.Cookies ("Adminok") = "" Then
Response.Redirect "Login.asp"
End If
%>
<%
Dim typename
Dim title
Dim content
Dim sql
Dim rs
Dim ArticleID
Title=htmlencode2 (Request.Form ("Txttitle"))
Content=htmlencode2 (Request.Form ("Txtcontent"))
Articleid=request ("id")
"Open the database to specify and update the specified record in the recordset
Set Rs=server.createobject ("Adodb.records



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.