| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 434 人关注过本帖
标题:[求助] 表单问题的程序代码
只看楼主 加入收藏
rsw
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2005-11-18
收藏
 问题点数:0 回复次数:3 
[求助] 表单问题的程序代码

这是表单问题的程序代码,请问高手tmp=1是什么作用呢?这种调用(seachout.asp 再调用它自己)是如何传递参数的,请高手给解释一下,多谢!


<%Option Explicit%><!--#include file="conn.asp"--><%
dim rs_lar
dim c_age,c_name,c_sex,c_netname,c_home,c_education,c_job,c_netcall,c_tel,c_book,c_music,c_sport,c_interest,c_character,c_photo
dim age1,age2,name,sex,netname,home,education,job,netcall,tel,sport,book,music,interest,character,photo
dim sql,str,hrefdate
dim pages,records,currentpage,linenumber,line,p

c_age =request("c_age")
c_name =request("c_name")
c_sex =request("c_sex")
c_netname =request("c_netname")
c_home =request("c_home")
c_education =request("c_education")
c_job =request("c_job")
c_netcall =request("c_netcall")
c_tel =request("c_tel")
c_sport =request("c_sport")
c_book =request("c_book")
c_music =request("c_music")
c_sport =request("c_sport")
c_interest =request("c_interest")
c_character =request("c_character")
c_photo =request("c_photo")

age1 =request("age1")
age2 =request("age2")
name =request("name")
sex =request("sex")
netname =request("netname")
home =request("home")
education =request("education")
job =request("job")
netcall =request("netcall")
tel =request("tel")
sport =request("sport")
book =request("book")
music =request("music")
sport =request("sport")
interest =request("interest")
character =request("character")
photo =request("photo")

Set rs_lar = Server.CreateObject("ADODB.Recordset")

hrefdate=""
sql="select * from larchives where cstr(lar_id) like '%'"
if c_age="ON" then
sql=sql & " and age>" & clng(age1) & " and age<" & clng(age2)
hrefdate=hrefdate & "&c_age=" & "ON" & "&age1=" & age1 & "age2=" & age2
end if
if c_name="ON" then
sql=sql & " and name like '" & name & "'"
hrefdate=hrefdate & "&c_age=" & "ON" & "&age1=" & age1 & "age2=" & age2
end if
if c_netname="ON" then
sql=sql & " and netname like '" & netname & "'"
hrefdate=hrefdate & "&c_netname=" & "ON" & "&netname=" & netname
end if
if c_sex="ON" then
sql=sql & " and sex like '" & sex & "'"
hrefdate=hrefdate & "&c_sex=" & "ON" & "&sex=" & sex
end if
if c_home="ON" then
sql=sql & " and home like '%" & home & "%'"
hrefdate=hrefdate & "&c_home=" & "ON" & "&home=" & home
end if
if c_education="ON" then
sql=sql & " and education like '" & education & "'"
hrefdate=hrefdate & "&c_education=" & "ON" & "&education=" & education
end if
if c_job="ON" then
sql=sql & " and job like '" & job & "'"
hrefdate=hrefdate & "&c_job=" & "ON" & "&job=" & job
end if
if c_netcall="ON" then
sql=sql & " and netcall like '%" & netcall & "%'"
hrefdate=hrefdate & "&c_netcall=" & "ON" & "&netcall=" & netcall
end if
if c_tel="ON" then
sql=sql & " and tel like '" & tel & "'"
hrefdate=hrefdate & "&c_tel=" & "ON" & "&tel=" & tel
end if
if c_sport="ON" then
sql=sql & " and sport like '%" & sport & "%'"
hrefdate=hrefdate & "&c_sport=" & "ON" & "&sport=" & sport
end if
if c_book="ON" then
sql=sql & " and book like '%" & book & "%'"
hrefdate=hrefdate & "&c_book=" & "ON" & "&book=" & book
end if
if c_music="ON" then
sql=sql & " and music like '%" & music & "%'"
hrefdate=hrefdate & "&c_music=" & "ON" & "&music=" & music
end if
if c_interest="ON" then
sql=sql & " and interest like '%" & interest & "%'"
hrefdate=hrefdate & "&c_interest=" & "ON" & "&interest=" & interest
end if
if c_character="ON" then
sql=sql & " and character like '%" & character & "%'"
hrefdate=hrefdate & "&c_character=" & "ON" & "&character=" & character
end if

if c_photo="ON" then
if photo="有" then sql=sql & " and photo>0" else sql=sql & " and photo=0"
hrefdate=hrefdate & "&c_photo=" & "ON" & "&photo=" & photo
end if

rs_lar.open sql,conn,3,2
if rs_lar.eof and rs_lar.bof then str="还没有一个会员!"
'分页设置
if str="" then
rs_lar.PageSize=20
pages=rs_lar.pagecount
records=rs_lar.recordcount
currentpage=request("currentpage")
if currentpage="" or currentpage<1 then currentpage=1
currentpage=cint(currentpage)
if currentpage>pages then currentpage=pages
rs_lar.absolutepage=currentpage
else
currentpage=1
records=0
pages=1
end if
%>

<!--#include file=top.asp -->

<table border="0" width="95%" height="28">
<tbody>
<form method=Post action="searchout.asp?tmp=1<%=hrefdate%>">
<tr>
<td colspan="2">
<img src="images/arrow.gif" width="12" height="12" align="top" border="0" hspace="5"><font class="titletext" color="#FF0099">以下是符合您搜索条件的网友</font>
</td>
</tr>
<tr>
<td>找到网友 <font color="red"><b><%=Records%></b></font> 位&nbsp; 页次: <font color="red"><b><%=currentpage%></b></font> / <font color="red"><b><%=Pages%></b></font> 页
</td>
<td align="right">
转到: <input type="text" name="currentpage" size=3 maxlength=6 class=put value="<%=currentpage%>"> 页
</td>
</tr>
</form>
</tbody>
</table>

<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td height="1" bgcolor="#FF99CC"></td>
</tr>
<tr>
<td align="center" background="images/bg2.gif">
<table border="0" cellspacing="0" width="95%">
<tbody>
<tr height="30">
<td width="19%"><font color="#FF0000">网 名</font></td>
<td width="7%" align="center"><font color="#FF0000">性别</font></td>
<td width="37%" align="center"><font color="#FF0000">所 在 地</font></td>
<td width="7%" align="center"><font color="#FF0000">年龄</font></td>
<td width="16%" align="center"><font color="#FF0000">入会日期</font></td>
<td width="7%" align="center"><font color="#FF0000">人气</font></td>
<td width="7%" align="center"><font color="#FF0000">活力</font></td>
</tr>
<%linenumber=rs_lar.pagesize%>
<%do while (not rs_lar.eof) and (line<linenumber)%>
<tr height="23">
<td width="19%"><a href="read.asp?user_id=<%=rs_lar("user_id")%>" title="查看网友<%=rs_lar("netname")%>的祥细资料"><%=rs_lar("netname")%></a></td>
<td width="7%" align="center"><%=rs_lar("sex")%></td>
<td width="37%"><%=rs_lar("home")%></td>
<td width="7%" align="center"><%=rs_lar("age")%></td>
<td width="16%" align="center"><%=rs_lar("date")%></td>
<td width="7%" align="center"><%=rs_lar("renqi")%></td>
<td width="7%" align="center"><%=rs_lar("huoli")%></td>
</tr>
<%rs_lar.movenext%>
<%line=line+1%>
<%loop%>
<%rs_lar.close%>
</tbody>
</table>
<tr>
<td height="1" background="images/hline.gif"></td>
</tr>
</tbody>
</table>

<table width="95%" height="28">
<tbody>
<tr>
<td><a href="wjxy.asp">重新搜索</a></td>
<td align="right">
<%if currentpage>1 then%>
<a href="searchout.asp?currentpage=<%=currentpage-1%><%=hrefdate%>">上一页</a>
<%end if%>
<%if currentpage<pages then%>
<a href="searchout.asp?currentpage=<%=currentpage+1%><%=hrefdate%>">下一页</a>
<%end if%>
<%if currentpage>1 then%>
<a href="searchout.asp?currentpage=1<%=hrefdate%>">首页</a>
<%end if%>
<%if currentpage<pages then%>
<a href="searchout.asp?currentpage=<%=pages%><%=hrefdate%>">末页</a>
<%end if%>
</td>
</tr>
</tbody>
</table>
<!--#include file=CopyRight.asp -->


搜索更多相关主题的帖子: 表单 代码 
2005-11-18 21:58
dreame
Rank: 3Rank: 3
等 级:新手上路
威 望:8
帖 子:521
专家分:0
注 册:2005-10-23
收藏
得分:0 

传递参数到searchout.asp


有时候真的想放弃寂寞的等待,但她是那么的可爱!I love u forever!
2005-11-18 22:22
rsw
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2005-11-18
收藏
得分:0 

上面这大段程序就是searchout.asp,当提交表单后,TMP=1传递给searchout.asp,又重新执行searchout.asp,这个程序怎么接受这个参数呢?

2005-11-18 22:28
阳光白雪
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:39
帖 子:2220
专家分:0
注 册:2005-11-18
收藏
得分:0 
在第一次提交后,

if c_age="ON" then
sql=sql & " and age>" & clng(age1) & " and age<" & clng(age2)
hrefdate=hrefdate & "&c_age=" & "ON" & "&age1=" & age1 & "age2=" & age2
end if
if c_name="ON" then
sql=sql & " and name like '" & name & "'"
hrefdate=hrefdate & "&c_age=" & "ON" & "&age1=" & age1 & "age2=" & age2
end if
if c_netname="ON" then
sql=sql & " and netname like '" & netname & "'"
hrefdate=hrefdate & "&c_netname=" & "ON" & "&netname=" & netname
end if
if c_sex="ON" then
sql=sql & " and sex like '" & sex & "'"
hrefdate=hrefdate & "&c_sex=" & "ON" & "&sex=" & sex
end if
if c_home="ON" then
sql=sql & " and home like '%" & home & "%'"
hrefdate=hrefdate & "&c_home=" & "ON" & "&home=" & home
end if
if c_education="ON" then
sql=sql & " and education like '" & education & "'"
hrefdate=hrefdate & "&c_education=" & "ON" & "&education=" & education
end if
if c_job="ON" then
sql=sql & " and job like '" & job & "'"
hrefdate=hrefdate & "&c_job=" & "ON" & "&job=" & job
end if
if c_netcall="ON" then
sql=sql & " and netcall like '%" & netcall & "%'"
hrefdate=hrefdate & "&c_netcall=" & "ON" & "&netcall=" & netcall
end if
if c_tel="ON" then
sql=sql & " and tel like '" & tel & "'"
hrefdate=hrefdate & "&c_tel=" & "ON" & "&tel=" & tel
end if
if c_sport="ON" then
sql=sql & " and sport like '%" & sport & "%'"
hrefdate=hrefdate & "&c_sport=" & "ON" & "&sport=" & sport
end if
if c_book="ON" then
sql=sql & " and book like '%" & book & "%'"
hrefdate=hrefdate & "&c_book=" & "ON" & "&book=" & book
end if
if c_music="ON" then
sql=sql & " and music like '%" & music & "%'"
hrefdate=hrefdate & "&c_music=" & "ON" & "&music=" & music
end if
if c_interest="ON" then
sql=sql & " and interest like '%" & interest & "%'"
hrefdate=hrefdate & "&c_interest=" & "ON" & "&interest=" & interest
end if
if c_character="ON" then
sql=sql & " and character like '%" & character & "%'"
hrefdate=hrefdate & "&c_character=" & "ON" & "&character=" & character
end if

if c_photo="ON" then
if photo="有" then sql=sql & " and photo>0" else sql=sql & " and photo=0"
hrefdate=hrefdate & "&c_photo=" & "ON" & "&photo=" & photo
end if


以上程序段才根据不同的情况给hrefdate定义值,接着执行的是下面的查询,返回结果,在没有再次提交表单的情况下也就不会在执行上面的程序了!


专注于WEB前端交互平台开发:[url=http://blog./]blog.[/url](富客户端技术(RIA)交流平台)
2005-11-19 09:11
快速回复:[求助] 表单问题的程序代码
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.040430 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved