I'm a little lost. I envision multiple was it could work...
1. User clicks on image, then you load another page with other stuff. (2 page views)
2. User clicks on image, onClick recognizes the click, calls a JavaScript function, which changes other DIVs from "hidden" to "visible". (1 page view)
3. User clicks, JavaScript calls the server (same machine, I guess) via AJAX to get some more information, then JS builds other DIV(s). (1 page view)
If you are pre-building the IMG tags (#2), that goes something like
// Javascript function
<script>
function foo()
{
document.bar.visibility = 'visible';
}
</script>
// visible image
echo "<div>";
echo "<img src=$url onClick=foo()>";
echo "</div>";
// Initially-hidden image:
... SELECT ... and put result into $url
echo "<div id=bar style=\"visibility=hidden">";
echo "<img src=$url>";
echo "</div>";
Caveat! There are probably typos, spelling errors, etc in the above code.
But I guess you were talking about #1. Can you elaborate.