View Full Version : hyperlink variable

06-22-2010, 01:56 PM
Hi, ok so I was trying to make a link using a variable.


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

doesn't seem to be working. What am I doing wrong?

Thanks for any help!

06-22-2010, 02:08 PM

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

06-22-2010, 02:59 PM


echo '<a href="'.$link.'">'.$name.'</a>';

Basically you forgot to quote your strings, and $ for variables is taken as a literal character in single quotes. When doing double quote strings with variables in them, I prefer to put squiggly braces around the variable.

echo "<a href=\"{$link}\">{$name}</a>";

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum