Print Page | Close Window

ASP help inserting record into hyperlink

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=30036
Printed Date: 28 March 2026 at 4:57pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: ASP help inserting record into hyperlink
Posted By: Pluribus
Subject: ASP help inserting record into hyperlink
Date Posted: 13 December 2011 at 4:44pm
Hi
 
I am a relative ASP newbie and need some help please.  I have a list of categories displayed on my page and need to make them into hyperlinks only displaying the category name itself, not the entire link.
 
I've managed to open the database connection and display the list of categories fine.  Unfortunately I cannot work out the code to get the category inserted into the hyperlink too.
 
In case I am not explaining myself well I have added a bit of code below which might help you understand what I am looking for:
 
This is what I have:
 
Response.Write (rsCategories("categories"))
Response.Write ("<br>")
 
Which displays to the user as:
 
English
Comprehension
Maths
Numeracy
 
What I need is the "proper" version of this (non working) code:
 
Response.Write(rsCategories("<a href="results.asp?pl=<%categories%>>categories</a>"))
Response.Write ("<br>")
 
This should still display to the user as the first example but each link should point to:
 
results.asp?pl=English
results.asp?pl=Comprehension
results.asp?pl=Maths
results.asp?pl=Numeracy
 
If someone could tell me where I have gone wrong I would really appreciate it!
 
Thanks
 
Ian



Replies:
Posted By: WebWiz-Bruce
Date Posted: 13 December 2011 at 5:09pm
Inside a Respose.Write string you need to escape quotes " with two quotes "". You also can not use <% varaible %> in this way and instaed need to use " & variable & "

Your line should be:-

Response.Write("<a href=""results.asp?pl=" & rsCategories("categories") & """>" & rsCategories("categories") & "</a>")


-------------
https://www.webwiz.net/web-wiz-forums/forum-hosting.htm" rel="nofollow - Web Wiz Forums Hosting
https://www.webwiz.net/web-hosting/windows-web-hosting.htm" rel="nofollow - ASP.NET Web Hosting


Posted By: Pluribus
Date Posted: 13 December 2011 at 5:18pm
100 billion % brilliant.  I have been struggling with that all afternoon.  You are a star WebWiz-Bruce and I think you have just saved my sanity, muchos appreciation and thanks :D



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net