mirta mirta - 7 months ago 9
HTML Question

insert php code in html a tag

I have a multi language website. I have three php files:

lang.de.php,lang.en.php, lang.hr.php


On index page I am changing text using this line of code:

<h2><?php echo $lang['TEXT'];?></h2>


Variable TEXT has different value in every lang.php file.

Now, I want to change the name of the .pdf file the same way, but I can't get it to work. I want to do something like this:

<a href="downloads/"<?php echo $lang['PDF_FILE'];?>".pdf"></a>


How can I do this?

Answer

Try to remove the double quotes before and after the

<a href="downloads/<?php echo $lang['PDF_FILE'];?>.pdf"></a>
Comments