Forum Moderators: coopster

Message Too Old, No Replies

Image gallery

How to generate pages off submit buttons?

         

macmuso

8:41 am on Jan 20, 2003 (gmt 0)

10+ Year Member



I am making a small image gallery, and want to automatically generate a page with the large image and the navigation system and information sidebar that is common to the rest of my website when a user clicks on the thumbnailed image.

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?

hakre

3:44 pm on Jan 20, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



hi macmuso,

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.

kindacheezy

4:20 pm on Jan 20, 2003 (gmt 0)

10+ Year Member



Try this put all of your images in one place and name them img1 for small img2 for big and so on when you set up your page do something like this

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.