By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,614 Members | 1,674 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,614 IT Pros & Developers. It's quick & easy.

Having problems displaying variables in php page

P: 2
when I echo "$variable<br>";

it shows the link perfect....

but when i create <a href="$variable">button</a>

i get a solid white page?

How should I be doing this? All i want is to turn my variable into a clickable link!
May 9 '07 #1
Share this Question
Share on Google+
2 Replies


P: 2
figured it out incase anyone else needs this

<a href="<?php echo "$variable"; ?>"> LINK HERE </a>
May 9 '07 #2

Motoma
Expert 2.5K+
P: 3,235
Thanks for posting the answer back when you discovered it. In PHP there are a number of different ways to do this:
[PHP]
<a href="<?=$variable?>">LINK HERE</a>
[/PHP]

[PHP]
<?php
echo "<a href=""$variable"">LINK HERE</a>";
?>
[/PHP]

[PHP]
<?php
echo '<a href="'.$variable.'">LINK HERE</a>';
?>
[/PHP]

What it really boils down to is that you were not calling $variable in PHP's scope (i.e. inside <?php ?> brackets).

Hope this helps.

figured it out incase anyone else needs this

<a href="<?php echo "$variable"; ?>"> LINK HERE </a>
May 9 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.