Active Server Pages question
#1
Anyone help - came across a problem today:
Trying to insert a recordset's field content into an HTML tag eg.
response.write "<A HREF=search.asp?textbox_category=" & recordset_search_results(1) & ">" & recordset_search_results(1) & "</A>"
Trouble is, if the recordset_search_results contains spaces (eg. plant engineers) it won't pick them up - it'll only insert plant into the tag.
I've tried converting it to a string and inserting that instead but I get the same results.
I've a feeling I may have to strip the spaces out manual and fill them with + instead - tell me there's a better way!
Any ideas ?
-DV
[This message has been edited by DazV (edited 21 May 2001).]
Trying to insert a recordset's field content into an HTML tag eg.
response.write "<A HREF=search.asp?textbox_category=" & recordset_search_results(1) & ">" & recordset_search_results(1) & "</A>"
Trouble is, if the recordset_search_results contains spaces (eg. plant engineers) it won't pick them up - it'll only insert plant into the tag.
I've tried converting it to a string and inserting that instead but I get the same results.
I've a feeling I may have to strip the spaces out manual and fill them with + instead - tell me there's a better way!
Any ideas ?
-DV
[This message has been edited by DazV (edited 21 May 2001).]
#4
Cheers Mr Cookie.
I think the problem is, if you ever try and pass a parameter in a hyperlink, and the parameter is string variable, you must ensure the string has no spaces in it.
eg. Dark Blue Mica, must be converted into Dark+Blue+Mica for it to work.
All sorted.
-DV
I think the problem is, if you ever try and pass a parameter in a hyperlink, and the parameter is string variable, you must ensure the string has no spaces in it.
eg. Dark Blue Mica, must be converted into Dark+Blue+Mica for it to work.
All sorted.
-DV
#6
Just for the sake of completeness, you can also embed double quotes in ASP code..
So
response.write "<A HREF=""*****.htm"">"
Will give <A HREF="*****.htm"> as output
A pair of double quotes is interpreted as meaning "put a double quote in the string".
It can get messy when you get things like "<A HREF=""" & myrs("URL") & """>"
Nick.
So
response.write "<A HREF=""*****.htm"">"
Will give <A HREF="*****.htm"> as output
A pair of double quotes is interpreted as meaning "put a double quote in the string".
It can get messy when you get things like "<A HREF=""" & myrs("URL") & """>"
Nick.
Trending Topics
#8
The deinitive answer (if there is such a thing). Simply add single quotes to the tag like this:
<A HREF=search.asp?textbox_category=" & recordset_search_results(1) & ">
now becomes:
<A HREF='search.asp?textbox_category=" & recordset_search_results(1) & "'>
So bloody simple (like most answers are!)
I'll get me coat...
-DV
<A HREF=search.asp?textbox_category=" & recordset_search_results(1) & ">
now becomes:
<A HREF='search.asp?textbox_category=" & recordset_search_results(1) & "'>
So bloody simple (like most answers are!)
I'll get me coat...
-DV
Thread
Thread Starter
Forum
Replies
Last Post
Brzoza
Engine Management and ECU Remapping
1
02 October 2015 05:26 PM