user1960419
user1960419

Reputation: 47

Adding link to an image inserted into header.php

        <?php

$image = "image-link.png"; 
$width = 300;
$height = 280;
echo '<img src="'.$image.'" style=width:"' . $width . 'px;height:' . $height . 'px;">';
?>

I just want to be able to click on the image and it will go to an external link. I am confused on how to do this next step

Upvotes: 0

Views: 551

Answers (1)

Halcyon
Halcyon

Reputation: 57729

echo '<a href="http://stackoverflow.com"><img src="'.$image.'" style=width:"'
  . $width . 'px;height:' . $height . 'px;"></a>';

Now clicking the image will take you to stackoverflow.com

Upvotes: 2

Related Questions