Use ASP to build your website News and Publishing (4)

Source: Internet
Author: User
In the previous section, our news system has been able to add and delete news online, but this is not enough, some users may need to find related news entries in a previous topic. However, a News system that is better than others can't help but complete this function.
Now let's add the retrieval function (full text/title) to our news system. First, let's make a retrieval form. See the following HTML code, place the code on the web page that requires news retrieval. You can easily complete news search.
<Form method = "POST" action = "http://XXX..com.cn/cgi-win/search/search.asp">
<P> <select name = "select" size = "1">
<Option selected value = "search_1"> News Retrieval (title) </option>
<Option value = "search_2"> News Retrieval (full text) </option>
</Select> <input type = "text" name = "key" size = "20"> <input type = "submit" value = "search"
Name = "search"> </p>
</Form>
    
Add the search ASP program search. asp on the basis of this FORM. In the form, we use the key parameter to indicate the string to be matched, while the select parameter specifies whether to search based on the full text or the title.
Now go to the program processing section and check out our search. asp program.
* Search. asp
<% @ Language = "vbscript" %>
<%
If request. form ("key") = "" then
Response. redirect "/"
End if
    
Select case request. form ("select ")
Case "search_1"
%>
<! -- # Include Virtual = "/cgi-win/search/news/data. inc" -->
<%
Set rs_1 = Server. CreateObject ("ADODB. Recordset ")
SQL = "select * from data where instr (news_title, '" & request. form ("key") & "')> 0"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.