Forum Moderators: coopster
How do I do this? I was thinking of having something like each image as a submit button; checking whether the form was submitted, and displaying the gallery if not, and if it was, the large image as
<img src="images/<?php echo $imagename;?>"> but couldn't get the submit buttons to do what I wanted, i.e. define the variable $imagename as the selected image. I know that sounds confusing (well it does to me anyway)... but is there a proper way to do this?
yes, it is possible. as i understood your post, you want the user to click on your small image (let's say thumbnail) or on a submit button next to. for this you only need to create a form for each thumbnail:
<form action="bigimage.php" method="post">
<input type="hidden" name="imagename" value="<?=$imagename?" />
<img src="images/thumb_<?=$imagename?>" alt="click on thumbnail to view image." />
<input type="submit" value="big" />
</form>
the solution is the <input type="hidden"> thingie, which will transport the image name to the bigimage.php.
lets call this page myimg.php
<?
echo'<img scr="img$n" alt=mypic>';//show the pic
if($n==1)
{
$n=$n+1;
$size="Big";
}
else
{
$n=1;
$size="small";
}
echo'<a href="./?n=$n">Make $size</a>';//make big or small
?>
and on your main page link to myimg.php?n=1
I hope this helps. There is also a way to use a test file if your pics are named differnt things.