Help with intranet search
Hi
Can you help me? I did have two seperate searches on our internal
intranet for 'products' and a 'site search' but I am trying to
incorporate these in to one. I am self taught in VBScript so don't
always understand some of the technical expressions. I have created a
seperate script to link to the original scripts (search_split.asp) but
this doesnt appear to be carrying over the value of the search box to
the pages as when the code is executed it just takes you to the search
page rather than actioning the search. I have place my code below.
Would appreciate any advise
Thanks
Kate
1st page (this is my form)
<form action="search_split.asp" method="post" name="keywordSearch">
<tr>
<td bordercolor="#FFFFFF" bgcolor="#FFFFFF"><div
align="center"><img src="img/search.bmp"></div></td>
</tr>
<tr>
<td width="89%" bordercolor="#FFFFFF"
bgcolor="#FFFFFF"><div align="center">
<p>
<label>
<input name="search1" type="radio"
value="keywordSearch">
<span class="style20">Site Search </span></
label>
<span class="style18">
<label>
<input name="search1" type="radio"
value="prodSearch">
</label>
<strong> Policy Type</strong></span><br>
<input name="search" type="text" class="ibox"
id="search" size="30">
<br>
<img src="img/spacer.gif" width="40"
height="6"><br>
<input name="image2" type="image" src="img/menu/
search2.GIF">
<br>
<label></label>
<br>
</p>
</div></td>
</tr>
</form>
2nd page (search_split.asp) (This redirects the code to the correct
page depending on what arial button is selcted)
<%
search = Request.Form ("search")
ser1 = Request.Form ("search1")
if ser1 = "keywordSearch" then
Response.Redirect ("keyword_search_test.asp")
elseif ser1 = "prodSearch" then
Response.Redirect ("products_test.asp")
end if
%>
One of the last pages (products_test.asp) (If arial button is a
product search)
<form action="products.asp" method="post" name="code">
<tr bgcolor="#FFFFFF">
<td width="29%" class="style1"><div
align="center"><span class="style7">Policy Type Code </span></div></
td>
<td width="54%"><div align="center">
<input name="search" type="text" class="ibox"
id="search">
</div></td>
<td width="17%"><div align="center">
<input name="Submit" type='submit' style='font:
10pt Arial, Helvetica, sans-serif; border:1 solid #CC0033;
cursor:hand; background:#FFFFFF; color: #000000; ' value="Search">
</div></td>
</tr>
</form>
<% if Request.QueryString("task") = "num" then %>
<table width="98%" border="0" align="center" cellpadding="2"
cellspacing="0">
<tr>
<td> </td>
</tr>
<tr>
<td><span class="style3">To search using the Policy Type
Code, you must enter a valid Policy Number</span></td>
</tr>
</table>
<% end if %>
<!-- Product Search
-------------------------------------------------------------- -->
<%
if Request.Form("search") <> "" OR Request.QueryString("search") <> ""
then
if Request.Form("search") = "" then
Qsearch = Request.QueryString("search")
prodSQL = "Select * From Policies Where PolTypeDesc Like
'"&Qsearch&"%' Order By PolTypeDesc Asc"
elseif Request.QueryString("search") = "" then
Fsearch = Request.Form("search")
if IsNumeric(Fsearch)= true then
'Response.Write IsNumeric(Fsearch) & "number"
else
Response.Redirect ("products_test.asp?task=num")
end if
prodSQL = "Select * From Policies Where PolType = " & Fsearch & "
Order By PolTypeDesc Asc"
end if
Set prodRS = Server.CreateObject("ADODB.Recordset")
prodRS.Open prodSQL, strConn
%>
<table width="98%" border="0" align="center" cellpadding="0"
cellspacing="1">
<tr>
<td class="style1"> </td>
</tr>
<tr>
<td class="style1"><strong>You searched for all products
begining with <%=search%> </strong></td>
</tr>
<tr>
<td bgcolor="#FFFFFF" class="style1"><hr size="1" noshade></
td>
</tr>
</table>
<%
if not prodRS.eof then
while not prodRS.eof
%>
<table width="98%" border="0" align="center" cellpadding="2"
cellspacing="0">
<tr>
<td height="25" class="style1"><strong class="style3"><a
href="productdetails.asp?pID=<%=prodRS("PolType")%>"><
%=prodRS("PolTypeDesc")%></a></strong></td>
</tr>
<tr>
<td class="style1"><strong>Policy Type:</strong> <span
class="style5"><%=prodRS("PolType")%> </span> </td>
</tr>
<% if Fsearch <> "" then %>
<tr>
<td class="style1"><strong>
<div align="right"><a href="view_APlist.asp?ap=<
%=prodRS("PolType")%>">View All AP's that provide this Policy</a> </
span> </div></td>
</tr>
<% end if %>
<tr>
<td class="style1"><hr size="1" noshade></td>
</tr>
</table>
<%
prodRS.MoveNext
wend
%>
<% else %>
<table width="98%" border="0" align="center" cellpadding="0"
cellspacing="0">
<tr>
<td> </td>
</tr>
<tr>
<td class="style1">There are no products to be displayed</
td>
</tr>
</table>
<%
end if
prodRS.Close
Set prodRS = Nothing
end if
%>
<% if Request.QueryString("search")= "" AND Request.Form("search")= ""
then%>
<table width="98%" border="0" align="center" cellpadding="0"
cellspacing="0">
<tr>
<td> </td>
</tr>
<tr>
<td class="style1">Please use the letters above to search
for the product you are looking for or alternatively enter the Product
code into the box above. </td>
</tr>
</table>
<% end if %>
One of the last pages (keyword_search_test.asp) (If arial button is a
site search)
<form action="keyword_search.asp" method="post" name="bulletins">
<tr bgcolor="#FFFFFF">
<td width="21%" class="style1"><div
align="center"><span class="style8">Search for </span></div></td>
<td width="61%"><div align="center">
<input name="search" type="text"
class="ibox" id="search" value="<% Response.Write
Request.Form("search")%>">
</div></td>
<td width="18%"><div align="center">
<input name="Submit" type='submit'
style='font:10pt Arial, Helvetica, sans-serif; border:1 solid #CC0033;
cursor:hand; background:#FFFFFF; color: #000000; '
onClick="YY_checkform('bulletins','search','#q','0','Please enter some
text to search for','category','#q','1','Please select a
category');return document.MM_returnValue" value="Search">
</div></td>
</tr>
</form>
<%
if Request.Form("search") = "" then
else
search = Request.Form("search")
bulSQL = "Select * From Bulletins Where Title Like '%"&search&"%' OR
Summary Like '%"&search&"%' Order By DateAdded Desc"
Set bulRS = Server.CreateObject ("ADODB.Recordset")
'bulSQL = "Select * From Bulletins Order By DateAdded Desc"
bulRS.Open bulSQL, strConn
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="style8 style9"><h3 class="style10">Op's
Briefs </h3></td>
</tr>
</table>
<%
if not bulRS.eof then
while not bulRS.eof
%>
<table width="100%" border="0" cellpadding="0" cellspacing="0"
bgcolor="#666666">
<tr>
<td>
<table width="100%" border="0" cellpadding="3"
cellspacing="1">
<tr>
<td width="83%" bgcolor="#E1E1E1"><strong> <a
href="ops_details.asp?bID=<%=bulRS("BulletinID")%>"> </a><img src="img/
attribs.gif" alt="<%=bulRS("Summary")%>" width="19" height="16"
align="absmiddle"><a href="ops_details.asp?bID=<%=bulRS("BulletinID")
%>"><%=bulRS("Title")%> </a></strong></td>
</tr>
</table>
</td>
</tr>
</table>
<table width="98%" border="0" align="center" cellpadding="0"
cellspacing="0">
<tr>
<td><p align="right"> </p></td>
</tr>
</table>
<%
bulRS.MoveNext
wend
%>
<% else %>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#666666"><table width="100%" border="0"
cellspacing="1" cellpadding="3">
<tr>
<td bgcolor="#E1E1E1" class="style1">There are no results to
display </td>
</tr>
</table></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
</tr>
</table>
<%
end if
bulRS.Close
Set bulRS = Nothing
end if
%>
<%
if Request.Form("search") = "" then
else
search = Request.Form("search")
bulSQL = "Select * From PolicyDocuments Where PolicyTitle Like
'%"&search&"%' "
Set bulRS = Server.CreateObject ("ADODB.Recordset")
'bulSQL = "Select * From Bulletins Order By DateAdded Desc"
bulRS.Open bulSQL, strConn
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="style8 style9"><h3 class="style10">Policy
Documents </h3></td>
</tr>
</table>
<%
if not bulRS.eof then
while not bulRS.eof
%>
<table width="100%" border="0" cellpadding="0" cellspacing="0"
bgcolor="#666666">
<tr>
<td><table width="100%" border="0" cellpadding="3"
cellspacing="1">
<tr>
<td width="83%" bgcolor="#E1E1E1"><img src="img/
attribs.gif" alt="<%=bulRS("Description")%>" width="19" height="16"
align="absmiddle"><strong> <a href="admin/<%=bulRS("FilePath")%>"
target="_blank"_blank""> <%=bulRS("PolicyTitle")%> </a> </strong></td>
</tr>
</table>
</td>
</tr>
</table>
<table width="98%" border="0" align="center" cellpadding="0"
cellspacing="0">
<tr>
<td><p align="right"> </p></td>
</tr>
</table>
<%
bulRS.MoveNext
wend
%>
<% else %>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#666666"><table width="100%" border="0"
cellspacing="1" cellpadding="3">
<tr>
<td bgcolor="#E1E1E1" class="style1">There are no results to
display </td>
</tr>
</table></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
</tr>
</table>
<%
end if
bulRS.Close
Set bulRS = Nothing
end if
%>
<%
if Request.Form("search") = "" then
else
search = Request.Form("search")
bulSQL = "Select * From Links Where LinkTitle Like '%"&search&"%' "
Set bulRS = Server.CreateObject ("ADODB.Recordset")
'bulSQL = "Select * From Bulletins Order By DateAdded Desc"
bulRS.Open bulSQL, strConn
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="style8 style9"><h3 class="style10">Links</
h3></td>
</tr>
</table>
<%
if not bulRS.eof then
while not bulRS.eof
%>
<table width="100%" border="0" cellpadding="0" cellspacing="0"
bgcolor="#666666">
<tr>
<td>
<table width="100%" border="0" cellpadding="3"
cellspacing="1">
<tr>
<td width="83%" bgcolor="#E1E1E1"><strong><img
src="img/attribs.gif" alt="<%=bulRS("LinkArea")%>" align="absmiddle">
<a href="<%=bulRS("LinkURL")%>" target="_blank"> <%=bulRS("LinkTitle")
%> </a> </strong></td>
</tr>
</table>
</td>
</tr>
</table>
<table width="98%" border="0" align="center" cellpadding="0"
cellspacing="0">
<tr>
<td><p align="right"> </p></td>
</tr>
</table>
<%
bulRS.MoveNext
wend
%>
<% else %>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#666666"><table width="100%" border="0"
cellspacing="1" cellpadding="3">
<tr>
<td bgcolor="#E1E1E1" class="style1">There are no results to
display </td>
</tr>
</table></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
</tr>
</table>
<%
end if
bulRS.Close
Set bulRS = Nothing
end if
%>
<%
if Request.Form("search") = "" then
else
search = Request.Form("search")
bulSQL = "Select * From News Where Title Like '%"&search&"%' OR
Summary Like '%"&search&"%' Order By DateAdded Desc"
Set bulRS = Server.CreateObject ("ADODB.Recordset")
'bulSQL = "Select * From Bulletins Order By DateAdded Desc"
bulRS.Open bulSQL, strConn
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="style8 style9"><h3 class="style10">News</
h3></td>
</tr>
</table>
<%
if not bulRS.eof then
while not bulRS.eof
%>
<table width="100%" border="0" cellpadding="0" cellspacing="0"
bgcolor="#666666">
<tr>
<td>
<table width="100%" border="0" cellpadding="3"
cellspacing="1">
<tr>
<td width="83%" bgcolor="#E1E1E1"><strong><img
src="img/attribs.gif" alt="<%=bulRS("Summary")%>"> <a href="news.asp?
newsID=<%=bulRS("NewsID")%>"> <%=bulRS("Title")%> </a> </strong></td>
</tr>
</table>
</td>
</tr>
</table>
<table width="98%" border="0" align="center" cellpadding="0"
cellspacing="0">
<tr>
<td><p align="right"> </p></td>
</tr>
</table>
<%
bulRS.MoveNext
wend
%>
<% else %>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#666666"><table width="100%" border="0"
cellspacing="1" cellpadding="3">
<tr>
<td bgcolor="#E1E1E1" class="style1">There are no results to
display </td>
</tr>
</table></td>
</tr>
</table>
<p>
<%
end if
bulRS.Close
Set bulRS = Nothing
end if
%>
date: 5 Nov 2007 12:01:27 -0800
author: unknown