<?php echo '<a href="lien_vers_page.html"><img src="lien_vers_image.jpg" alt="Description de l\'image"></a>'; ?>

Solved
Enki -  
 boom -
Bonjour,

To display an image in PHP, you use:
{print("<img src=\"./image.jpg\" border=\"0\">");}

But to display an image with a link, I don’t know how to do it.
In HTML, I know it's <a href="image.jpg">See image</a>

And in PHP?

8 answers

  1. Zeos
     
    Well, even if the last message is a bit dated.. (2007) it should be noted that PHP is code interpreted by a server.
    This server does what it's told, so in HTML if we want to display an image with a link we would do:

    <a href="(LINK WITHOUT PARENTHESES)"> <img src="(IMAGES WITHOUT PARENTHESES)" /> </a>

    in PHP it could be written in different ways:

    <?php // we open the PHP tag, note that your page must be of type .php

    print "<a href=\"(LINK WITHOUT PARENTHESES)\"> <img src=\"(IMAGES WITHOUT PARENTHESES)\" /> </a>";
    // note the backslashes before the "
    print '<a href="(LINK WITHOUT PARENTHESES)"> <img src="(IMAGES WITHOUT PARENTHESES)" /> </a>';
    // note that there are no backslashes before the " because we are entering the text with '

    echo "<a href=\"(LINK WITHOUT PARENTHESES)\"> <img src=\"(IMAGES WITHOUT PARENTHESES)\" /> </a>";
    echo '<a href="(LINK WITHOUT PARENTHESES)"> <img src="(IMAGES WITHOUT PARENTHESES)" /> </a>';

    // same for the last 2 except for the change of function print and echo are the same!

    ?>
    6