you want to use php my friend...
(or ASP or some other kind of server side langauge)
Here's a nice simple example to display a name and a photo depending on what info is passed via the url:
Code:
<html>
<body>
<?
print('Picture of '.$name.'<br>');
print('<img src="'.$pic.'" alt="'.$name.'">');
?>
</body>
</html>
Then the page can display different images by being called like so:
mypage.php?name=sweenster&pic=me.jpg
mypage.php?name=frone&pic=you.jpg