hi,
I'm trying combine 3 different search criteria, but the keyword search is ignored.
I think the problem could be with my submit form, so I'll show that as well.
Any ideas gratefully received
Gav
this is the form-
<div style="position:absolute;top:60;left:100">
<table><tr><td>
<form method="post" action="industrysearchregion.asp">
<input type="text" name="Jobtitle" size="12">
<input type="hidden" "submit">
<font color="#1818ac"><b>Add a keyword refine search</b><br>
</form>
</td></tr></table>
</div>
<div style="position:absolute;top:60;left:300">
<table><tr><td>
<%
Dim oRSv
Set oRSv=Server.CreateObject("adodb.Recordset"
oRSv.Open "IndustryTable", "dsn=50on"
oRSv.MoveFirst
%>
<form method="post" action="industrysearchregion.asp">
<font color="#1818ac"><b>Search by job sector and location</b></font><br>
<select name="industry" size="1">
<%
Do While NOT oRSv.EOF
Response.Write "<option value='" & oRSv("industry" & "'>"
Response.Write oRSv("industry" & "</option>"
oRSv.MoveNext
loop
oRSv.Close
Set oRSv=nothing
%>
</select>
<%
Dim oRSr
Set oRSr=Server.CreateObject("adodb.Recordset"
oRSr.Open "RegionTable", "dsn=50on"
oRSr.MoveFirst
%>
<form method="post" action="industrysearchregion.asp">
<select name="region" size="1">
<%
Do While NOT oRSr.EOF
Response.Write "<option value='" & oRSr("region" & "'>"
Response.Write oRSr("region" & "</option>"
oRSr.MoveNext
loop
oRSr.Close
Set oRSr=nothing
%>
</select>
<input type="IMAGE" SRC="go.gif" border="0">
</form>
</td></tr></table></div>
Response page looks like-
%
varindustry=Request.Form("industry"
varregion=Request.Form("region"
varJobtitle=Request.Form("Jobtitle"
Dim oRS2
dim iRowCounter
Set oRS2=Server.CreateObject("adodb.Recordset"
sSQL="SELECT JobTable.ID, CompanyTable.ID, JobTable.CompanyID, CompanyTable.Company, JobTable.industry, JobTable.Jobtitle, JobTable.region, JobTable.Jobdescription"
sSQL=sSQL & " FROM JobTable"
sSQL=sSQL & " RIGHT JOIN CompanyTable"
sSQL=sSQL & " ON CompanyTable.ID = JobTable.CompanyID"
sSQl=sSQL & " WHERE region='" & varregion & "'"
sSQl=sSQL & " AND Jobdescription LIKE '%" & varJobtitle & "%'"
sSQL=sSQL & " AND industry='" & varindustry & "'"
sSQL=sSQL & " ORDER BY JobTable.Jobtitle;"
oRS2.open sSQL, "DSN=50on"
if oRS2.EOF=True then
Response.write "<font color=#1818ac>Sorry, no jobs were found in this sector"
else oRS2.MoveFirst
response.write "<table bgcolor=#babdd9 align=center width=43% border=0>"
response.write "<th bgcolor=white><img src=jobtitletab.gif></th>" & "<th bgcolor=white><img src=sectortab.gif></th>" & "<th bgcolor=white><img src=companytab.gif></th>" & "<th bgcolor=white><img src=regiontab.gif></th>"
Do while Not oRS2.EOF
Response.Write "<tr><td><a href=displayjob2.asp?ID=" & oRS2 ("ID" & ">" & oRS2 ("Jobtitle" & "</a></td>"
Response.Write "<td>" & oRS2 ("industry" & "</td>"
response.write "<td>" & oRS2 ("Company" & "</td>"
response.write "<td>" & oRS2 ("region" & "</td></tr>"
oRS2.MoveNext
Loop
end if
oRS2.Close
set oRS2=Nothing
response.write "</table>"
%>
</font>
I'm trying combine 3 different search criteria, but the keyword search is ignored.
I think the problem could be with my submit form, so I'll show that as well.
Any ideas gratefully received
Gav
this is the form-
<div style="position:absolute;top:60;left:100">
<table><tr><td>
<form method="post" action="industrysearchregion.asp">
<input type="text" name="Jobtitle" size="12">
<input type="hidden" "submit">
<font color="#1818ac"><b>Add a keyword refine search</b><br>
</form>
</td></tr></table>
</div>
<div style="position:absolute;top:60;left:300">
<table><tr><td>
<%
Dim oRSv
Set oRSv=Server.CreateObject("adodb.Recordset"
oRSv.Open "IndustryTable", "dsn=50on"
oRSv.MoveFirst
%>
<form method="post" action="industrysearchregion.asp">
<font color="#1818ac"><b>Search by job sector and location</b></font><br>
<select name="industry" size="1">
<%
Do While NOT oRSv.EOF
Response.Write "<option value='" & oRSv("industry" & "'>"
Response.Write oRSv("industry" & "</option>"
oRSv.MoveNext
loop
oRSv.Close
Set oRSv=nothing
%>
</select>
<%
Dim oRSr
Set oRSr=Server.CreateObject("adodb.Recordset"
oRSr.Open "RegionTable", "dsn=50on"
oRSr.MoveFirst
%>
<form method="post" action="industrysearchregion.asp">
<select name="region" size="1">
<%
Do While NOT oRSr.EOF
Response.Write "<option value='" & oRSr("region" & "'>"
Response.Write oRSr("region" & "</option>"
oRSr.MoveNext
loop
oRSr.Close
Set oRSr=nothing
%>
</select>
<input type="IMAGE" SRC="go.gif" border="0">
</form>
</td></tr></table></div>
Response page looks like-
%
varindustry=Request.Form("industry"
varregion=Request.Form("region"
varJobtitle=Request.Form("Jobtitle"
Dim oRS2
dim iRowCounter
Set oRS2=Server.CreateObject("adodb.Recordset"
sSQL="SELECT JobTable.ID, CompanyTable.ID, JobTable.CompanyID, CompanyTable.Company, JobTable.industry, JobTable.Jobtitle, JobTable.region, JobTable.Jobdescription"
sSQL=sSQL & " FROM JobTable"
sSQL=sSQL & " RIGHT JOIN CompanyTable"
sSQL=sSQL & " ON CompanyTable.ID = JobTable.CompanyID"
sSQl=sSQL & " WHERE region='" & varregion & "'"
sSQl=sSQL & " AND Jobdescription LIKE '%" & varJobtitle & "%'"
sSQL=sSQL & " AND industry='" & varindustry & "'"
sSQL=sSQL & " ORDER BY JobTable.Jobtitle;"
oRS2.open sSQL, "DSN=50on"
if oRS2.EOF=True then
Response.write "<font color=#1818ac>Sorry, no jobs were found in this sector"
else oRS2.MoveFirst
response.write "<table bgcolor=#babdd9 align=center width=43% border=0>"
response.write "<th bgcolor=white><img src=jobtitletab.gif></th>" & "<th bgcolor=white><img src=sectortab.gif></th>" & "<th bgcolor=white><img src=companytab.gif></th>" & "<th bgcolor=white><img src=regiontab.gif></th>"
Do while Not oRS2.EOF
Response.Write "<tr><td><a href=displayjob2.asp?ID=" & oRS2 ("ID" & ">" & oRS2 ("Jobtitle" & "</a></td>"
Response.Write "<td>" & oRS2 ("industry" & "</td>"
response.write "<td>" & oRS2 ("Company" & "</td>"
response.write "<td>" & oRS2 ("region" & "</td></tr>"
oRS2.MoveNext
Loop
end if
oRS2.Close
set oRS2=Nothing
response.write "</table>"
%>
</font>