I am trying to write an html site that shows an image. The image source is defined by:
<img src="<? echo htmlspecialchars($_GET['id']; ?>.jpg">
It doesn't do anything besides generating an ERR_FILE_NOT_FOUND
as it fails to load the ressource, while replacing the source with "1.jpg" renders the image. The href links to example.com/page.html?id=1
.
Do I have to include something like <?php $id = $_GET['id']; ?>
at the beginning of the body?
Full code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Slideshow Test</title>
<link rel="stylesheet" href="./style.css">
<link rel="shortcut icon" href="./img/Shortcut.ico" type="image/ico">
</head>
<body class="a12">
<?php /**$id = $_GET['id']; **/?>
<div align="center">
<tr height="460">
<td class="a10" height="460" width="566">
<div align="center"></div>
<img src="<? echo htmlspecialchars($_GET['id']); ?>.jpg" alt="an image" height="460" border="0">
</td>
</tr>
</div>
</body>
</html>