新手求教-前台页面表单提交问题
建了一个数据库 就一个ID自动排序和联系电话TEL俩数据在后台测试添加修改删除都可以了
但是在前台想直接弄一个表单 输入朋友联系电话 然后点提交 就写入数据库的功能
很简单一个功能
测试了几次都不行
已经弄迷糊了 大侠们帮忙啊
<!--#include file="AppCode/Conn.asp"--> <% Select Case Trim(Request.Form("action")) Case "add" Call Add() Call SaveAdminLog("添加:" & gh) Call CloseConn() Call ActionOk("123.asp") End Select %> <table cellspacing="0" cellpadding="0" width="100%" align="center" border="0"> <tbody> <tr> <td > <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td align="center">姓名</td> <td align="center">手机号码</td> <td align="center"> </td> </tr> <form name="form2" method="post" action=""> <tr bgcolor="#FFFFFF"> <td align="center"><input name="gh" type="text" id="gh" size="8" /></td> <td align="center"><input name="tel" type="text" id="tel" size="11" /></td> <td align="center"> <input name="action" type="hidden" id="action" /> <input name="Submit" type="submit" onClick="javascript:formsubmit(this.form,'add');" value="添加" /></td> </tr> </form> </table><script language="JavaScript" type="text/javascript"> function formsubmit(frm,action) { if(frm.gh.value.trim()=="") { ShowErrMsg("姓名不能为空,请输入"); frm.gh.focus(); return false; } frm.action.value = action; frm.submit(); } </script> </td> </tr> </tbody> </table> <% Call CloseConn() Set Rs = Nothing Set Admin = Nothing %> <% Public id Public gh Public tel Public Sub Add() Call GetFormData() Set clsRs = Server.CreateObject("Adodb.RecordSet") Sql = "select * from somoos where 1=2" clsRs.Open Sql,Conn,1,3 clsRs.AddNew() Call UpdateRs(clsRs) clsRs.Update() clsRs.Close() Set clsRs = Nothing End Sub Private Sub GetFormData() id = Trim(Request.Form("id")) gh = Trim(Request.Form("gh")) tel = Trim(Request.Form("tel")) End Sub Private Sub UpdateRs(ByRef clsRs) clsRs("gh") = gh clsRs("tel") = tel End Sub Public Sub GetRs(ByRef clsRs) id = clsRs("id") gh = clsRs("gh") tel = clsRs("tel") End Sub %>