Re: php question
| From: | Torsten Roehr | Date: | Wed, 18 Aug 2004 08:28:45 +0000 |
| Subject: | Re: php question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-194128@lists.php.net to get a copy of this message | ||
"Michael Crane" <crane@ukonline.co.uk> wrote in message
news:41228B37.1020500@ukonline.co.uk...
> hello,
> I have a webpage which includes a frame containing a table made of 24
> tds which in turn contain little images. When the mouse clicks on a
> little image the appropriate larger image is loaded into an adjacent
frame.
> Can somebody point me in the direction to do this in php without frames
> please ?
>
> I've been looking most of the day but I can't see it.
>
> regards
>
> mick
Hi Mick,
you have to append the file name of the bigger version to your links as a
parameter:
<a href="<?php= $_SERVER['PHP_SELF'];
?>?image=name_of_the_big_file1">big
picture 1</a>
<a href="<?php= $_SERVER['PHP_SELF'];
?>?image=name_of_the_big_file2">big
picture 2</a>
<a href="<?php= $_SERVER['PHP_SELF'];
?>?image=name_of_the_big_file3">big
picture 3</a>
Exchange name_of_the_big_file1/2/3 with the file names of the big image
versions. Then at the point where you want to show the big image include
this code:
<?php
if (isset($_GET['image'])) {
$image = basename($_GET['image']);
echo '<img src="' . $image . '" border="0"
alt="">';
}
?>
Of course you may have to alter the src attribute if your pictures are not
in the same directory.
Hope this helps, regards.
Torsten Roehr