Author |
Topic |
|
e3stone
Average Member
USA
885 Posts |
Posted - 01 May 2001 : 09:04:17
|
I know how to fill the list box from the db, but here's my problem: I'm using this code to populate the list box:
quote: <select name="select1"> <% For intSelect1Count = 1 to rs.recordcount response.write("<option value=" & rs("type") & ">" & rs("type") & "</option>") rs.movenext Next rs.movefirst %> </select>
now, I'm filling the list box with employment category values, like "Database Administrator", "Accounting", "Software" but, on the search result page with I do a request.form("select1") and I've chosen "Database Administrator" it only returns "Database" I was doing the search on the database with this statement: quote: " WHERE [SKILL.TYPE] like '%" & request.form("select1") & "%'"
but, that will return "Database Administrator", "Database Assistant", and everything else that starts with "Database"
How can I return just the records which have "Database Administrator"??
do I have to trim() that 'value=" & rs("type")' ??
I'm stuck here. Any help would be great
<-- Eric -->
http://insidewaco.com/forum |
|
HuwR
Forum Admin
United Kingdom
20584 Posts |
Posted - 01 May 2001 : 10:06:16
|
I think the problem is the space in the value.
what does it think request.form("select1") is equal to?
|
|
|
e3stone
Average Member
USA
885 Posts |
Posted - 01 May 2001 : 10:28:33
|
Yeah, the space is the problem. If I pick "Database Administrator" and search that, request.form("select1") has a value of "Database"
How do I make it where the value passed is "Database Administrator"?
<-- Eric -->
http://insidewaco.com/forum
Edited by - e3stone on 01 May 2001 11:49:32 |
|
|
HuwR
Forum Admin
United Kingdom
20584 Posts |
Posted - 01 May 2001 : 13:22:01
|
try doing something like
response.write("<option value=" & replace(rs("type")," ","_") & ">" & rs("type") & "</option>")
and then
" WHERE [SKILL.TYPE] like '%" & replace(request.form("select1"),"_"," ") & "%'"
|
|
|
jasonterryinc
Starting Member
USA
1 Posts |
Posted - 01 May 2001 : 13:37:03
|
To pass a value with a space in it, you must make sure that the value="" has the quotes (or single ticks) around it. Looking at your code, you are not including quotes around the values you are pulling from your database.
You only need to update one line and it will work. Copy and paste the following line over the corresponding line in your code:
response.write("<option value='" & rs("type") & "'>" & rs("type") & "</option>")
|
|
|
e3stone
Average Member
USA
885 Posts |
Posted - 01 May 2001 : 14:18:46
|
Thanks Huw, that works. I just changed it to quote: [SKILL.TYPE] = '" & replace(request.form("select6"),"_"," ") & "'"
so it wouldn't return everything that started with "Database"
<-- Eric -->
http://insidewaco.com/forum |
|
|
e3stone
Average Member
USA
885 Posts |
Posted - 01 May 2001 : 14:24:16
|
yeah Jason, that was my problem. grrrr, can't believe that I (and Huw) went through all that because of a silly " ' " mark. Oh well, now I know
<-- Eric -->
http://insidewaco.com/forum |
|
|
HuwR
Forum Admin
United Kingdom
20584 Posts |
Posted - 01 May 2001 : 16:00:13
|
my eyes are obvioysly getting bad, missed it when I looked
|
|
|
|
Topic |
|