Jump to content


Photo

using variables in h ref tag


  • Please log in to reply
6 replies to this topic

#1 saco

saco
  • Members
  • Pip
  • Newbie
  • 4 posts

Posted 13 October 2006 - 04:31 PM

Hi!

I am having problems inserting variables into h ref.

how do I do it?

#2 MrLarkins.com

MrLarkins.com
  • Members
  • PipPip
  • Member
  • 20 posts

Posted 13 October 2006 - 04:34 PM

hmm, need more info, but i'll try a blind answer

echo ("<a href='$link'>$link</a>");





#3 tleisher

tleisher
  • Members
  • PipPipPip
  • Advanced Member
  • 88 posts

Posted 13 October 2006 - 04:37 PM

Or you could also do:

echo "<a href='"" . $var . "\">Link</a>";

#4 saco

saco
  • Members
  • Pip
  • Newbie
  • 4 posts

Posted 13 October 2006 - 04:43 PM

Hi!,
this is the problem I am having:

echo("<tr><td><a href=http://www.test.com/$item_name.htm>Download</a></td></tr>");

$item_name is the variable, and I need to put the file extension after the variable.

the reply is http://www.test.com/.htm

thanks very much! - sorry, disregard last post
Saco

#5 MrLarkins.com

MrLarkins.com
  • Members
  • PipPip
  • Member
  • 20 posts

Posted 13 October 2006 - 04:47 PM

is the url a variable? or just the clickable text?

#6 tleisher

tleisher
  • Members
  • PipPipPip
  • Advanced Member
  • 88 posts

Posted 13 October 2006 - 05:01 PM

echo "<tr><td><a href=\"http://www.test.com/" . $item_name . ".html\">Download</a></td></tr>";

#7 MrLarkins.com

MrLarkins.com
  • Members
  • PipPip
  • Member
  • 20 posts

Posted 13 October 2006 - 05:04 PM

ah, i see what he was trying to ask...good job tleisher!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users