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).] |
Sorted - I've used the cheap and cheerful command 'replace' to do the job.
Let me know if there's a better way. -DV |
Daz i dont know alot about html and dont really understand what your doing, but with urls and linking them if there a space i have to put in %20.
Si |
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 |
Not 100% certain as I'm currently away from my ASP books but I think that server.urlencode (str) will do the encoding for you....
no flames please if it doesn't http://bbs.scoobynet.co.uk/smile.gif |
Just for the sake of completeness, you can also embed double quotes in ASP code..
So response.write "<A HREF=""balls.htm"">" Will give <A HREF="balls.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") & """>" http://bbs.scoobynet.co.uk/biggrin.gif Nick. |
Cool Kryten - will give it a try!
-DV |
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 |
Cheers Nick - thats a great tip.
-DV |
All times are GMT +1. The time now is 03:49 AM. |
© 2024 MH Sub I, LLC dba Internet Brands