Page 1 of 1

PHP / HTML

Posted: Fri Dec 03, 2010 12:12 pm
by liran
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.

Re: PHP / HTML

Posted: Fri Dec 03, 2010 12:16 pm
by social_experiment
Forgive me if my answer is vague but that's only in response to the vague question. And you are half-way there:

Code: Select all

<?php
  // how it should be
 $address = "http://cnn.com";
 echo '<a href="'. $address .'" >Go To</a>';
?>
Also, don't use short tags ( <? ), rather go for the full version.

Re: PHP / HTML

Posted: Sat Dec 04, 2010 9:03 am
by liran
Thanks !