6 Replies - 1661 Views - Last Post: 04 February 2005 - 12:04 PM Rate Topic: -----

#1 bexlhoward1  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 40
  • Joined: 04-February 05

Putting A Link To A Webpage On Text

Posted 04 February 2005 - 10:11 AM

Hi, I want to make the text displayed from an Access database a link. I know how to do this just by surrounding it in <a href></a> but I want it to link to a path from the database. Does anyone know how I do this? An example of what i want is when a user searches for a book then can click on the title for more information.

Thanks
Is This A Good Question/Topic? 0
  • +

Replies To: Putting A Link To A Webpage On Text

#2 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 247
  • View blog
  • Posts: 13,505
  • Joined: 12-July 02

Re: Putting A Link To A Webpage On Text

Posted 04 February 2005 - 10:15 AM

In your href tag, instead of putting a hardcoded url, just put in the information from the DB.

Assuming 2 fields from DB: text, url

<a href="urlfromdb">textfromdb</a>


Was This Post Helpful? 0
  • +
  • -

#3 bexlhoward1  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 40
  • Joined: 04-February 05

Re: Putting A Link To A Webpage On Text

Posted 04 February 2005 - 10:23 AM

If I add the variable name to the <a href> I get a 'page cannot be displayed error and in the address bar it is trying to link to 'Object' rather than the actual path.

<a href= '".$Path."' target = blank>$title->value</a>
Was This Post Helpful? 0
  • +
  • -

#4 bexlhoward1  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 40
  • Joined: 04-February 05

Re: Putting A Link To A Webpage On Text

Posted 04 February 2005 - 10:36 AM

Its ok, ive done it! I do have another question, how would I pass variable from one page to another so i could dynamically generate a page?

Thanks
Was This Post Helpful? 0
  • +
  • -

#5 skyhawk133  Icon User is offline

  • Head DIC Head
  • member icon

Reputation: 1813
  • View blog
  • Posts: 20,232
  • Joined: 17-March 01

Re: Putting A Link To A Webpage On Text

Posted 04 February 2005 - 10:39 AM

You can pass variables in a few different ways, the 2 easiest are to use variables in the URL like this:

http://yourdomain.co...able2=somevalue

You can also use a form to pass variables to another page, either way the result is the same. The variables are available on the page by referencing the variable name you used.
Was This Post Helpful? 0
  • +
  • -

#6 bexlhoward1  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 40
  • Joined: 04-February 05

Re: Putting A Link To A Webpage On Text

Posted 04 February 2005 - 10:50 AM

Would I need to set up an array to do this as the variable would be in a table generated from the database. Which is why i used:

 print "<tr><td><b>Title:</b> 
   <a href= $Path->value target = blank>$title->value</a><br><b>Author:</b>
    $Author->value<br><b>ISBN:</b> $ISBN->value<br><b>Year:</b> $Year->value <br><b>Availability:</b> 
    $Availability->value</td><td valign = top><a href=../index.htm>Reserve</a></td></tr>";
  print "<tr><td rowspan = 2><hr noshade></td></tr>";

Was This Post Helpful? 0
  • +
  • -

#7 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 247
  • View blog
  • Posts: 13,505
  • Joined: 12-July 02

Re: Putting A Link To A Webpage On Text

Posted 04 February 2005 - 12:04 PM

You can pass it as an array (through a form would be best for that) or string it all together in one string (with identifiable separators), and break it apart on the other side.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1