PDA

View Full Version : $_GET question


BroChris
04-23-2003, 08:32 PM
I'm still really new to php, trying to learn as I go.

On one page, I have this:
<a href="pictures.php?pic1">
<img src="images/pic1-t.jpg" class="pic" width=75 height=75 alt="picture">
</a>
Then, on pictures.php I have this:
<img src="images/
<?php echo $_GET ?>
.jpg class="pic" width=640 height=480 alt="picture">
I think you can tell what I'm trying to do. The result is that the image on pictures.php looks instead for Array.jpg, and is therefore a broken image. What am I doing wrong?

(the line breaks above are only for readability on this forum. the actual pages do not have line breaks)

Ökii
04-23-2003, 08:38 PM
$_GET is actually an array wherein which most people use associative indices (or var=val pairs)

you might get away with echo $_GET[0], though I would suggest defining a named index as the value and using that

pictures.php?img=pic1
....
echo $_GET['img'] => 'pic1'

as that allows you to keep track of multiple variables a lot easier - eg ?img=pic1&img2=pic2 etc etc

BroChris
04-23-2003, 08:43 PM
I was also missing a quotation mark, but thanks! That works great.