I'm trying to dynamically insert an URL in an imagemap using PHP.
- I check if the current URL contains a substring.
If yes the url will be ...
If no the url will be.. - In case there is a problem with PHP I do a check if the variable $myurl exists.
If not assign a default value to $myurl - Then I insert the variable $myurl in the imagemap.
However it doesn't work.
When I move the mouse over my image map I see this as URL: <?= $myurl ?>
What did I wrong?
The code:
[1]
if (strpos($_SERVER['REQUEST_URI'], "/nl/") !== false){
$myurl = "url2"
} else {
$myurl = "url1"
}
[2]
if (!isset($myurl)) {
$myurl = "url1"
}
[3]
<img src="../imagemap_blue.png" usemap="#imagemap2">
<map name="imagemap2">
<area shape="rect" alt="" coords="15,5,302,55" href="<?= $myurl ?>">
</map>