日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

搜索表单制作语法:强大的搜索功能

發(fā)布時(shí)間:2025/3/15 编程问答 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 搜索表单制作语法:强大的搜索功能 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

搜索表單變量說明

變量名
說明
例子

搜索表單提交地址
POST方式:/e/search/index.php
<form name="searchform" method="post" action="/e/search/index.php">

GET方式:/e/search/?searchget=1
/e/search/?searchget=1&keyboard=帝國(guó)&show=title

keyboard
搜索關(guān)鍵字變量
<input name="keyboard" type="text">

show
搜索字段變量(多個(gè)字段用","格開。搜索字段必須是后臺(tái)模型開啟搜索的字段)
<input type="hidden" name="show" value="title,newstext">

classid
搜索欄目ID(不設(shè)置為不限,多個(gè)欄目可用","格開,設(shè)置父欄目會(huì)搜索所有子欄目)
<input type="hidden" name="classid" value="1">

ztid
搜索專題ID(不設(shè)置為不限,多個(gè)專題可用","格開)
<input type="hidden" name="ztid" value="1">

tbname
按數(shù)據(jù)表搜索(需與搜索模板ID結(jié)合)
<input type="hidden" name="tbname" value="news">

tempid
所用搜索模板ID(一般跟按表搜索結(jié)合使用)
<input type="hidden" name="tempid" value="1">

starttime與endtime
分別為搜索發(fā)布起始時(shí)間與結(jié)束時(shí)間的信息(不填為不限.格式:2008-02-27)
<input name="starttime" type="text" value="0000-00-00" size="12">
<input name="endtime" type="text" value="0000-00-00" size="12">

startprice與endprice
分別為商品價(jià)格的起始價(jià)格與結(jié)束價(jià)格(不填為不限)
<input name="startprice" type="text" value="0" size="6">
<input name="endprice" type="text" value="0" size="6">

搜索特殊字段
id : 按信息ID搜索
keyboard : 按關(guān)鍵字搜索(可實(shí)現(xiàn)按tags列出信息)
userid : 按發(fā)布者用戶ID搜索
username : 按發(fā)布者用戶名搜索
<input type="hidden" name="show" value="keyboard">

member
值為0則不限制
值為1則為只搜索會(huì)員投稿的信息
值為2則為只搜索管理員增加的信息
<input type="hidden" name="member" value="1">

orderby
排序字段:
0:按發(fā)布日期(默認(rèn))
1:按ID
2:按評(píng)論數(shù)
3:按瀏覽人氣
4:按下載數(shù)
<input type="hidden" name="orderby" value="1">

myorder
排序方式:
0:倒序排列(默認(rèn))
1:順序排列
<input type="hidden" name="myorder" value="1">

andor
設(shè)置多條件查詢之間關(guān)聯(lián)關(guān)系,有兩種:
or : 或者的關(guān)系(默認(rèn))
and : 并且的關(guān)系
<input type="hidden" name="andor" value="and">

hh
邏輯運(yùn)算聯(lián)結(jié)符變量:
LT : 小于
GT : 大于
EQ : 等于
LE : 小于等于
GE : 大于等于
NE : 不等于
IN : 包含(搜索關(guān)鍵字用空格隔開每個(gè)值)
BT : 范圍,兩個(gè)值之間(搜索關(guān)鍵字用空格隔開兩個(gè)值)
LK : 模糊查詢(默認(rèn))
<input type="hidden" name="hh" value="LK">

單條件搜索表單制作范例

一、表單范例1:

1、用Dreamweaver制作好表單:

設(shè)計(jì)視圖:

代碼模式下的表單代碼

<table width="320" border="0" cellspacing="1" cellpadding="3">
<form name="searchform" method="post" action="/e/search/index.php">
??? <tr>
????? <td>關(guān)鍵字:<input name="keyboard" type="text" size="10"></td>
????? <td>范圍:
<select name="show">
????????? <option value="title">標(biāo)題</option>
????????? <option value="smalltext">簡(jiǎn)介</option>
????????? <option value="newstext">內(nèi)容</option>
????????? <option value="writer">作者</option>
????????? <option value="title,smalltext,newstext,writer">搜索全部</option>
??????? </select></td>
??? </tr>
??? <tr>
????? <td>欄 目:
<select name="classid">
????????? <option value="0">搜索全部</option>
????????? <option value="1">新聞中心</option>
????????? <option value="4">技術(shù)文檔</option>
????????? <option value="22">下載中心</option>
??????? </select> </td>
????? <td><input type="submit" name="submit" value="搜索"></td>
??? </tr>
</form>
</table>

2、最終搜索表單顯示效果為下圖:

搜索表單多條件并列搜索語(yǔ)法說明

多字段、多邏輯運(yùn)算聯(lián)結(jié)符并列搜索

(一)、多字段并列搜索:有“字符串”與“數(shù)組”兩種傳遞方式

1、字符串傳遞為例子:

<input type="hidden" name="hh" value="LK">
<input type="hidden" name="show" value="title,writer">
<input type="hidden" name="keyboard" value="標(biāo)題,作者">
(說明:上面為模糊查詢title字段包含“標(biāo)題”字符或者writer字段包含“作者”的信息)

2、數(shù)組傳遞為例子:

<input type="hidden" name="hh" value="LK">
<input type="hidden" name="show[]" value="title">
<input type="hidden" name="keyboard[]" value="標(biāo)題">
<input type="hidden" name="show[]" value="writer">
<input type="hidden" name="keyboard[]" value="作者">
(說明:上面為模糊查詢title字段包含“標(biāo)題”字符或者writer字段包含“作者”的信息)

(二)、多邏輯運(yùn)算聯(lián)結(jié)符并列搜索

1、字符串傳遞為例子:

<input type="hidden" name="hh" value="LK,EQ">
<input type="hidden" name="show" value="title,writer">
<input type="hidden" name="keyboard" value="標(biāo)題,作者">
(說明:上面為模糊查詢title字段包含“標(biāo)題”字符或者writer字段等于“作者”的信息)

2、字符串傳遞為例子:

<input type="hidden" name="show[]" value="title">
<input type="hidden" name="hh[]" value="LK">
<input type="hidden" name="keyboard[]" value="標(biāo)題">
<input type="hidden" name="show[]" value="writer">
<input type="hidden" name="hh[]" value="EQ">
<input type="hidden" name="keyboard[]" value="作者">
(說明:上面為模糊查詢title字段包含“標(biāo)題”字符或者writer字段等于“作者”的信息)

多條件并列搜索的表單制作范例

二、表單范例2:實(shí)現(xiàn)按標(biāo)題、作者、錄入者與信息ID同時(shí)搜索的表單

1、用Dreamweaver制作好表單:

設(shè)計(jì)視圖:

代碼模式下的表單代碼

上面例子html代碼

<form name="searchform" method="post" action="/e/search/index.php">
? <table width="550" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
<input type="hidden" name="tbname" value="news">
??? <input type="hidden" name="tempid" value="1">
??? <input type="hidden" name="andor" value="and">
??? <tr class="header">
????? <td colspan="2">新聞搜索</td>
??? </tr>
??? <tr bgcolor="#FFFFFF">
????? <td width="97">標(biāo)題:</td>
????? <td width="388">
<input type="hidden" name="show[]" value="title">
????????? <input type="hidden" name="hh[]" value="LK">
????????? <input name="keyboard[]" type="text">
????? </td>
??? </tr>
??? <tr bgcolor="#FFFFFF">
????? <td>作者:</td>
????? <td>
<input type="hidden" name="show[]" value="writer">
????????? <input type="hidden" name="hh[]" value="LK">
????????? <input name="keyboard[]" type="text">
????? </td>
??? </tr>
??? <tr bgcolor="#FFFFFF">
????? <td>錄入者:</td>
????? <td>
<input type="hidden" name="show[]" value="username">
????????? <input type="hidden" name="hh[]" value="EQ">
????????? <input name="keyboard[]" type="text">
????? </td>
??? </tr>
??? <tr bgcolor="#FFFFFF">
????? <td>信息ID范圍:</td>
????? <td>
<input type="hidden" name="show[]" value="id">
????????? <input type="hidden" name="hh[]" value="BT">
????????? <input name="keyboard[]" type="text">
??????? <font color="#666666">(例:“1 6”表示1到6之間) </font>
????? </td>
??? </tr>
??? <tr bgcolor="#FFFFFF">
????? <td>&nbsp;</td>
????? <td>
??????? <input type="submit" name="Submit" value="馬上搜索">
??????? <font color="#666666">(不設(shè)置為不限)</font>
????? </td>
??? </tr>
? </table>
</form>

2、最終搜索表單顯示效果為下圖:

轉(zhuǎn)載于:https://www.cnblogs.com/dedecms8/archive/2011/03/23/1983764.html

總結(jié)

以上是生活随笔為你收集整理的搜索表单制作语法:强大的搜索功能的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。