Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

combining 2 select fields with keyword search, not picked up

Status
Not open for further replies.

gavray

Programmer
Jul 17, 2000
65
GB
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=&quot;position:absolute;top:60;left:100&quot;>
<table><tr><td>
<form method=&quot;post&quot; action=&quot;industrysearchregion.asp&quot;>
<input type=&quot;text&quot; name=&quot;Jobtitle&quot; size=&quot;12&quot;>
<input type=&quot;hidden&quot; &quot;submit&quot;>
<font color=&quot;#1818ac&quot;><b>Add a keyword refine search</b><br>
</form>
</td></tr></table>
</div>


<div style=&quot;position:absolute;top:60;left:300&quot;>
<table><tr><td>
<%
Dim oRSv
Set oRSv=Server.CreateObject(&quot;adodb.Recordset&quot;)
oRSv.Open &quot;IndustryTable&quot;, &quot;dsn=50on&quot;
oRSv.MoveFirst
%>

<form method=&quot;post&quot; action=&quot;industrysearchregion.asp&quot;>
<font color=&quot;#1818ac&quot;><b>Search by job sector and location</b></font><br>
<select name=&quot;industry&quot; size=&quot;1&quot;>

<%
Do While NOT oRSv.EOF
Response.Write &quot;<option value='&quot; & oRSv(&quot;industry&quot;) & &quot;'>&quot;
Response.Write oRSv(&quot;industry&quot;) & &quot;</option>&quot;
oRSv.MoveNext
loop
oRSv.Close
Set oRSv=nothing
%>
</select>



<%
Dim oRSr
Set oRSr=Server.CreateObject(&quot;adodb.Recordset&quot;)
oRSr.Open &quot;RegionTable&quot;, &quot;dsn=50on&quot;
oRSr.MoveFirst
%>

<form method=&quot;post&quot; action=&quot;industrysearchregion.asp&quot;>
<select name=&quot;region&quot; size=&quot;1&quot;>

<%
Do While NOT oRSr.EOF
Response.Write &quot;<option value='&quot; & oRSr(&quot;region&quot;) & &quot;'>&quot;
Response.Write oRSr(&quot;region&quot;) & &quot;</option>&quot;
oRSr.MoveNext
loop
oRSr.Close
Set oRSr=nothing
%>

</select>
<input type=&quot;IMAGE&quot; SRC=&quot;go.gif&quot; border=&quot;0&quot;>
</form>
</td></tr></table></div>

Response page looks like-

%
varindustry=Request.Form(&quot;industry&quot;)
varregion=Request.Form(&quot;region&quot;)
varJobtitle=Request.Form(&quot;Jobtitle&quot;)

Dim oRS2
dim iRowCounter
Set oRS2=Server.CreateObject(&quot;adodb.Recordset&quot;)

sSQL=&quot;SELECT JobTable.ID, CompanyTable.ID, JobTable.CompanyID, CompanyTable.Company, JobTable.industry, JobTable.Jobtitle, JobTable.region, JobTable.Jobdescription&quot;
sSQL=sSQL & &quot; FROM JobTable&quot;
sSQL=sSQL & &quot; RIGHT JOIN CompanyTable&quot;
sSQL=sSQL & &quot; ON CompanyTable.ID = JobTable.CompanyID&quot;
sSQl=sSQL & &quot; WHERE region='&quot; & varregion & &quot;'&quot;
sSQl=sSQL & &quot; AND Jobdescription LIKE '%&quot; & varJobtitle & &quot;%'&quot;
sSQL=sSQL & &quot; AND industry='&quot; & varindustry & &quot;'&quot;
sSQL=sSQL & &quot; ORDER BY JobTable.Jobtitle;&quot;

oRS2.open sSQL, &quot;DSN=50on&quot;

if oRS2.EOF=True then
Response.write &quot;<font color=#1818ac>Sorry, no jobs were found in this sector&quot;

else oRS2.MoveFirst

response.write &quot;<table bgcolor=#babdd9 align=center width=43% border=0>&quot;

response.write &quot;<th bgcolor=white><img src=jobtitletab.gif></th>&quot; & &quot;<th bgcolor=white><img src=sectortab.gif></th>&quot; & &quot;<th bgcolor=white><img src=companytab.gif></th>&quot; & &quot;<th bgcolor=white><img src=regiontab.gif></th>&quot;


Do while Not oRS2.EOF

Response.Write &quot;<tr><td><a href=displayjob2.asp?ID=&quot; & oRS2 (&quot;ID&quot;) & &quot;>&quot; & oRS2 (&quot;Jobtitle&quot;) & &quot;</a></td>&quot;
Response.Write &quot;<td>&quot; & oRS2 (&quot;industry&quot;) & &quot;</td>&quot;
response.write &quot;<td>&quot; & oRS2 (&quot;Company&quot;) & &quot;</td>&quot;
response.write &quot;<td>&quot; & oRS2 (&quot;region&quot;) & &quot;</td></tr>&quot;

oRS2.MoveNext

Loop
end if
oRS2.Close
set oRS2=Nothing
response.write &quot;</table>&quot;
%>

</font>
 
here is a tip which may help
Below the SQL statement put this:
------------------------------------
<%response.write &quot;SQL &quot; & sSQL%>
<%response.write &quot;Indus &quot; & varindustry%>
<%response.write &quot;Region &quot; & varregion%>
<%response.write &quot;Job &quot; & varJobtitle%>
------------------------------------

Then you can see if infact you are passing anything and what is being added to the SQL statement and if it looks OK


DougP, MCP
dposton@universal1.com

Ask me how Bar-codes can help you be more productive.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top