Hello
I have the following PHP file:
<?php
?>
<html>
<? $address = "cnn.com"; ?>
<A href="<?=$address?>">Go To</A>
</html>
I want the link value to be "cnn.com", and take it from a variable as I did. What's wrong here, and how I can fix it ?
( PHP 5.2.6, but tried it on PHP 5.3.3 too)
thanks.
PHP / HTML
Moderator: General Moderators
- social_experiment
- DevNet Master
- Posts: 2793
- Joined: Sun Feb 15, 2009 11:08 am
- Location: .za
Re: PHP / HTML
Forgive me if my answer is vague but that's only in response to the vague question. And you are half-way there:
Also, don't use short tags ( <? ), rather go for the full version.
Code: Select all
<?php
// how it should be
$address = "http://cnn.com";
echo '<a href="'. $address .'" >Go To</a>';
?>“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering