Add Php Variable Inside Echo Statement As Href Link Address?


Answer :

Try like

HTML in PHP :

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

Or even you can try like

echo "<a href='$link_address'>Link</a>"; 

Or you can use PHP in HTML like

PHP in HTML :

<a href="<?php echo $link_address;?>"> Link </a> 

you can either use

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

or

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

if you use double quotes you can insert the variable into the string and it will be parsed.


Basically like this,

<?php $link = ""; // Link goes here! print "<a href="'.$link.'">Link</a>"; ?> 

Comments

Popular posts from this blog

Are Regular VACUUM ANALYZE Still Recommended Under 9.1?

Can Feynman Diagrams Be Used To Represent Any Perturbation Theory?