Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - ASP help inserting record into hyperlink
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

ASP help inserting record into hyperlink

 Post Reply Post Reply
Author
Pluribus View Drop Down
Newbie
Newbie
Avatar

Joined: 03 March 2011
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote Pluribus Quote  Post ReplyReply Direct Link To This Post Topic: ASP help inserting record into hyperlink
    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
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Answer Answer
Post Options Post Options   Thanks (1) Thanks(1)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post 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>")
Back to Top
Pluribus View Drop Down
Newbie
Newbie
Avatar

Joined: 03 March 2011
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote Pluribus Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.