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
Putting A Link To A Webpage On Text
Page 1 of 16 Replies - 1661 Views - Last Post: 04 February 2005 - 12:04 PM
Replies To: Putting A Link To A Webpage On Text
#2
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
Assuming 2 fields from DB: text, url
<a href="urlfromdb">textfromdb</a>
#3
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>
<a href= '".$Path."' target = blank>$title->value</a>
#4
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
Thanks
#5
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.
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.
#6
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>";
#7
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.
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote




|