Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Senior Coder Len Whistler's Avatar
    Join Date
    Jul 2002
    Location
    Vancouver, BC Canada
    Posts
    1,323
    Thanks
    26
    Thanked 100 Times in 100 Posts

    Using $_GET to pass on values.

    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 Code:
    <?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 Code:
    <?php
     $iName 
    $_GET['id'];
    ?><table><img class="view" src="images/ads/<?echo "$iName";?>.jpg"></table>
    Thanks

    Leonard Whistler
    Last edited by Len Whistler; 06-05-2005 at 05:31 AM.
    Leonard Whistler

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    You need to add it to the link:
    PHP Code:
    <?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>"
    ;   


    ?>

  • #3
    Senior Coder Len Whistler's Avatar
    Join Date
    Jul 2002
    Location
    Vancouver, BC Canada
    Posts
    1,323
    Thanks
    26
    Thanked 100 Times in 100 Posts
    Thanks Fou-Lu.

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

    Leonard Whistler
    www.stubby.ca
    Leonard Whistler

  • #4
    Senior Coder Len Whistler's Avatar
    Join Date
    Jul 2002
    Location
    Vancouver, BC Canada
    Posts
    1,323
    Thanks
    26
    Thanked 100 Times in 100 Posts
    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
    Leonard Whistler


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •