Write a news system using the DB class today (click to view the DB class)
Add news main code
<Form action = "news_add_up.asp? Tabname = news "onSubmit =" return isok (this) "method =" post "name =" upload "id =" upload "> <table width =" 100% "border =" 0 "class =" df "> <tr> <td> <div align = "right"> title: </div> </td> <div align = "left"> <input name = "Title" type = "text" id = "Title" size = "80 "> </div> </td> </tr> <td> <div align =" right "> time: </div> </td> <div align = "left"> <input name = "time" type = "text" id = "time" value = "< % = date () %> "> </div> </td> </tr> <td> <div align =" right "> author: </div> </td> <div align = "left"> <input name = "Author" type = "text" id = "Author"> </div> </td> </tr> <td> <div align = "right"> No: </div> </td> <div align = "left"> <input name = "list" type = "text" id = "list" value = "0 "size =" 10 "> </div> </td> </tr> <td> <div align =" right "> content: </div> </td> <div align = "left"> <textarea name = "Content" cols = "75" rows = "25" id = "Content "> </textarea> </div> </td> </tr> <td> <div align =" right "> </div> </td> <td> <div align = "left"> <input name = "formSubmit" type = "submit" id = "formSubmit" value = "submit"> <input type = "reset "name =" Submit2 "value =" reset "> </div> </td> </tr> <td> & nbsp; </td> <td> & nbsp; </td> </tr> </table> </form>
Note: The input name is the same as the database name. If you do not want the added database to include form in the name. For example, formSubmit
News_add_up.asp main code
<! -- # Include file = "db. asp "--> <% server_back = Request. serverVariables ("HTTP_REFERER") set mydb = new dbid = request. queryString ("id") tabname = request. queryString ("tabname") mydb. addEditRS tabname, id mydb. closeresponse. write "<script language = JavaScript>" & chr (13) & "alert ('Operation successful !!! '); "& Chr (13) &" location. href =' "& server_back &" '; "&" </script> "%>
In this way, you can add news! The modification is no longer written. It is similar to this action = "news_add_up.asp? Tabname = news & id = id ", mainly to make the input name and the field name in the table the same line ~!