...

View Full Version : Using $_GET to pass on values.



Len Whistler
06-05-2005, 05:29 AM
I need help on this script, which I got from a previous post of mine.

It passes on the values of "$row[im_name]" to the view.php page and displays the image when the link is clicked. But I can't figure out how to get it to also pass the values of "$row[im_comments]" to the view.php page at the same time. I would like the view.php page to show the image and the comments, which come from the MySQL database.


gallery.php

<?php

while($row = mysql_fetch_array($sql)){

echo "<table><a href=\"view.php?id=$row[im_name]\">
<img src=\"images/thumbs/$row[im_name]\"></a>
<span class=\"highlight\">$row[im_name]</span>
<br>$row[im_comments]<tr><hr>";

}
?>

Values "$row[im_name]" and "$row[im_comments]" to be passed to the view.php. "$row[im_name]" values are passed successfully.

view.php

<?php
$iName = $_GET['id'];
?><table><img class="view" src="images/ads/<?echo "$iName";?>.jpg"></table>

Thanks

Leonard Whistler

Fou-Lu
06-05-2005, 05:47 AM
You need to add it to the link:


<?php

while($row = mysql_fetch_array($sql)){

echo "<table><a href=\"view.php?id=$row[im_name]&amp;com=$row[im_comments]\">
<img src=\"images/thumbs/$row[im_name]\"></a>
<span class=\"highlight\">$row[im_name]</span>
<br>$row[im_comments]<tr><hr>";

}
?>

Len Whistler
06-05-2005, 06:11 AM
Thanks Fou-Lu.

Its late now and I will work on it in the morning.

Leonard Whistler
www.stubby.ca

Len Whistler
06-05-2005, 07:25 PM
I got that method to work but only a limited amount of information is sent through the $_GET method, about 100 characters. Some of my image comments are longer than 100 characters and they get cut off.

CF member Serex, the source of the original code, has posted a different solution which I will try later on tonight.

Leonard Whistler
www.stubby.ca



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum