Jump to content

Image Form Gallery


junkywunky

Recommended Posts

Hi,

 

I want to have a row of 5 images and when I click on one of the images I go to another page and it displays that same image. So on the first page I've got this:

 

<form name="imgForm" action="b.php" method="post">

<input type="image" name="selectedImg" src="1.gif">

<input type="image" name="selectedImg" src="2.gif">

<input type="image" name="selectedImg" src="3.gif">

<input type="image" name="selectedImg" src="4.gif">

<input type="image" name="selectedImg" src="5.gif">

</form>

 

and on the php page I've got this:

 

<?php

$selectedImg = $_POST["selectedImg"];

print ("$selectedImg")

?>

 

but when I click nothing shows up. Any ideas?

Link to comment
https://forums.phpfreaks.com/topic/45191-image-form-gallery/
Share on other sites

[ code ][ /code ]

why do it that way?

table of images

<?php
echo "
<a href='?img=1.gif'><img src="1.gif"></a>
<a href='?img=2.gif'><img src="2.gif"></a>
<a href='?img=3.gif'><img src="3.gif"></a>
<a href='?img=4.gif'><img src="4.gif"></a>
<a href='?img=5.gif'><img src="5.gif"></a>";
?>
<

image page

<?php
$image = $_GET['img'];
echo "image file: $img<br />";
echo "<img scr='$image'>";
?>

Link to comment
https://forums.phpfreaks.com/topic/45191-image-form-gallery/#findComment-219379
Share on other sites

oh and why ur didnt work:

you need to put:

<form name="imgForm" action="b.php" method="post">
<input type="image" value= "1" name="selectedImg" src="1.gif">
<input type="image" value= "2" name="selectedImg" src="2.gif">
<input type="image" value= "3" name="selectedImg" src="3.gif">
<input type="image" value= "4" name="selectedImg" src="4.gif">
<input type="image" value= "5" name="selectedImg" src="5.gif">
</form>

Link to comment
https://forums.phpfreaks.com/topic/45191-image-form-gallery/#findComment-219381
Share on other sites

sorry, forgot to mention the first part segment of code is from a html file whereas the second isn't so that code doesn't work.

 

so, now in a.html I've got:

 


<form name="imgForm" action="b.php" method="get">
<input type="image" value= "1" name="selectedImg" src="1.gif">
<input type="image" value= "2" name="selectedImg" src="2.gif">
<input type="image" value= "3" name="selectedImg" src="3.gif">
<input type="image" value= "4" name="selectedImg" src="4.gif">
<input type="image" value= "5" name="selectedImg" src="5.gif">
</form>

 

and in b.php I've got:

 

<?php
$image = $_GET['img'];
echo "image file: $img<br />";
echo "<img scr='$image'>";
?>

 

so what am I doing wrong?

Link to comment
https://forums.phpfreaks.com/topic/45191-image-form-gallery/#findComment-219393
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.