新微赢技术网

标题: [求助]新手求教,表单提交~谢谢 [打印本页]

作者: 地上跑    时间: 2010-1-7 02:08
标题: [求助]新手求教,表单提交~谢谢
提交表单
姓名电话地址
张三123456 北京
李四456789广州
点击按钮能添加新的一行,提交是存入相同的字段里。如:张三,李四存入“姓名”里;123456,456789存入“电话”里,该怎么做呢?
查看的时候呢?

新手求教,希望能详细写,或者给个实例也行~
谢谢各位大大了^^
作者: 牛牛    时间: 2010-1-7 02:08
我也需要
作者: 紫色&飘蓝ぁ    时间: 2010-1-7 02:09
我刚写的一段代码,
你看一看了.
<!--#include file="pwd.asp"-->
<!--#include file=conn1.asp-->
<%
if request("action")="edit" then
id=request("id")
hb=request("hb")
hl=request("hl")
qsrq=request("qsrq")
tzrq=request("tzrq")
hb1=request("hb1")
hl1=request("hl1")
qsrq1=request("qsrq1")
sql="update hbhl set hl="&hl1&",qsrq="&qsrq1&",tzrq="&qsrq&"where id="&id
conn1.execute sql
sql="select * from hbhl"
set rs=server.createObject("adodb.recordset")
rs.open sql,conn1,1,2
rs.addnew
rs("hb")=hb
rs("hl")=hl
rs("qsrq")=qsrq
rs("tzrq")=30000000
rs.update
rs.close
set rs=nothing
response.write "<script language='javascript'>alert('修改成功!')</script>"
response.redirect "rate.asp"
end if


%>
<%
if request("action")="modify" then

id=request("id")
sql="select * from hbhl where id="&id
set rs=server.createObject("adodb.recordset")
rs.open sql,conn1,1,1
if not (rs.eof and rs.bof) then
%>

<p align=center><span class="style1">修改汇率</span><br>

<form name="form2" method="post" action="rate.asp?action=modsubmit&id=<%=id%>" onsubmit="return(check());">
<table width="218" border="0" cellspacing="0" cellpadding="0" style="border-left:1px solid #BD7124;border-right:1px solid #BD7124;border-top:1px solid #BD7124;border-bottom:1px solid #BD7124; ">
<tr>
<td height="25" style="border-right:1px solid #BD7124;border-bottom:1px solid #BD7124; "> 货  币:</td>
<td style="border-bottom:1px solid #BD7124; "><input name="hb" type="text" value=<%=rs("hb")%> size="10"></td></tr>
<tr>
<td height="25" style="border-right:1px solid #BD7124;border-bottom:1px solid #BD7124; "> 汇  率:</td>
<td style="border-bottom:1px solid #BD7124; "><input name="hl" type="text" size="10" value=<%=rs("hl")%>></td></tr>
<tr><td height="25" style="border-right:1px solid #BD7124;border-bottom:1px solid #BD7124; ">起始日期:</td><td style="border-bottom:1px solid #BD7124; "><input name="qsrq" type="text" size="10" value=<%=rs("qsrq")%>></td></tr>

<tr><td height="25" style="border-right:1px solid #BD7124;border-bottom:1px solid #BD7124; ">停止日期:</td><td style="border-bottom:1px solid #BD7124; "><input name="tzrq" type="text" value=<%=rs("tzrq")%> size="10"></td></tr>
<tr align="center">
<td height="25" colspan="2">
<input type="submit" name="Submit" value="修  改"></td>
</tr>


</table>
</form>

<%
end if
rs.close
set rs=nothing
response.end
end if
%>

<%
if request("action")="modsubmit" then

id=request("id")
hb=request("hb")
hl=request("hl")
qsrq=request("qsrq")
tzrq=request("tzrq")

sql="update hbhl set hb='"&request("hb")&"',hl="&request("hl")&",qsrq="&request("qsrq")&",tzrq="&request("tzrq")&" where id="&id
conn1.execute(sql)
response.redirect "rate.asp"
end if
%>
<%
if request("action")="delsubmit" then

id=request("id")


sql="delete from hbhl where id="&id
conn1.execute(sql)
response.redirect "rate.asp"
end if
%>
<%
set rs=server.CreateObject("ADODB.recordset")
set rs1=server.CreateObject("ADODB.recordset")
sql1="select * from hbhl order by id"
sql="select * from hbhl order by tzrq desc"
rs.open sql,conn1,1,1
rs1.open sql1,conn1,1,1
qsrq_old1=rs("qsrq")
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>汇率修改</title>
<script java="javascript">
function check(){
var regex=/^\d(\.)^\d/;
var qsrq=document.form1.qsrq.value;
var qsrq_old='<%=qsrq_old1%>';
var hl=document.form1.hl.value;
var flag=false;

if (hl==""){

alert("汇率不能为空!");
return false;

}
if (regex.test(hl)){

alert("汇率只能为整数或小数!");
 return false;

}

if(parseInt(qsrq)>parseInt(qsrq_old)){

flag=true;
}
else{

alert("您输入的起始日期不对!");
flag=false;
}
return flag;

}
</script>
<style type="text/css">
<!--
.style1 {
font-size: 18px;
font-weight: bold;
}
-->
</style>
</head>
<body>
<%
if not(rs1.eof and rs1.bof) then %>
<p align=center>原有汇率信息</p>
<table width="500" border="0" align="center" cellpadding="0" cellspacing="0" style="border-left:1px solid #BD7124;border-right:1px solid #BD7124;border-top:1px solid #BD7124;border-bottom:1px solid #BD7124; ">
<tr align="center">
<td width="66" style="border-right:1px solid #BD7124;border-bottom:1px solid #BD7124; ">货  币</td>
<td width="78" style="border-right:1px solid #BD7124;border-bottom:1px solid #BD7124; ">利  率</td>
<td width="78" style="border-right:1px solid #BD7124;border-bottom:1px solid #BD7124; ">起始日期</td>
<td width="78" style="border-right:1px solid #BD7124;border-bottom:1px solid #BD7124; ">停止日期</td>
<td width="78" style="border-right:1px solid #BD7124;border-bottom:1px solid #BD7124; ">修  改</td>
<td width="80" style="border-right:1px solid #BD7124;border-bottom:1px solid #BD7124; ">删  除</td>
</tr>
<%do while not rs1.eof%>
<tr align="center">
<td style="border-right:1px solid #BD7124;border-bottom:1px solid #BD7124; "><%=rs1("hb")%></td>
<td style="border-right:1px solid #BD7124;border-bottom:1px solid #BD7124; "><%=rs1("hl")%></td>
<td style="border-right:1px solid #BD7124;border-bottom:1px solid #BD7124; "><%=rs1("qsrq")%></td>
<td style="border-right:1px solid #BD7124;border-bottom:1px solid #BD7124; "><%=rs1("tzrq")%></td>
<td style="border-right:1px solid #BD7124;border-bottom:1px solid #BD7124; "><a href="rate.asp?action=modify&id=<%=rs1("id")%>">修改</a></td>
<td style="border-right:1px solid #BD7124;border-bottom:1px solid #BD7124; "><a href="rate.asp?action=delsubmit&id=<%=rs1("id")%>" onclick="return(confirm('确定要删除吗?'))">删除</a></td>
</tr>
<%
rs1.movenext
loop
%>
</table>
<%
end if
%>

<%

if not (rs.eof and rs.bof) then
%>
<center>

<p><span class="style1">添加新一期汇率</span><br>

<form name="form1" method="post" action="rate.asp?action=edit" onsubmit="return(check());">
<table width="218" border="0" cellspacing="0" cellpadding="0" style="border-left:1px solid #BD7124;border-right:1px solid #BD7124;border-top:1px solid #BD7124;border-bottom:1px solid #BD7124; ">
<tr>
<td height="25" style="border-right:1px solid #BD7124;border-bottom:1px solid #BD7124; "> 货  币:</td>
<td style="border-bottom:1px solid #BD7124; "><input name="hb" type="text" value=<%=rs("hb")%> size="10" readonly></td></tr>
<tr>
<td height="25" style="border-right:1px solid #BD7124;border-bottom:1px solid #BD7124; "> 汇  率:</td>
<td style="border-bottom:1px solid #BD7124; "><input name="hl" type="text" size="10"></td></tr>
<tr><td height="25" style="border-right:1px solid #BD7124;border-bottom:1px solid #BD7124; ">起始日期:</td><td style="border-bottom:1px solid #BD7124; "><input name="qsrq" type="text" size="10"></td></tr>

<tr><td height="25" style="border-right:1px solid #BD7124;border-bottom:1px solid #BD7124; ">停止日期:</td><td style="border-bottom:1px solid #BD7124; "><input name="tzrq" type="text" value=30000000 size="10" readonly></td></tr>
<tr align="center">
<td height="25" colspan="2"><input type="hidden" name="hb1" value=<%=rs("hb")%>>
<input type="hidden" name="hl1" value=<%=rs("hl")%>>
<input type="hidden" name="id" value=<%=rs("id")%>>
<input type="hidden" name="qsrq1" value=<%=rs("qsrq")%>>
<input type="submit" name="Submit" value="添 加"></td>
</tr>


</table>
</form>
</center>
<% end if%>
</body>
</html>
只能看不能运行了.
作者: 绿茶    时间: 2010-1-7 02:09
不太明白...也不能运行...
帮忙解释一下吧~或者给个能运行简单点的实例~
谢谢了




欢迎光临 新微赢技术网 (http://bbs.weiying.cn/) Powered by Discuz! X3.2