SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Nov 2006
    Posts
    110
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how do i passing variable(in link) to next page ?

    I have a page which loop the thumnail of all image. if I click on the link, i would like to display the actual image.

    main page looping code :
    while ($row = mysql_fetch_array($result)) {
    $id = $row['photo_id'];
    $Photofilename = $row['photo_filename'];
    $Divername = $row['Divername'];
    $Locationname = $row['Locationname'];
    $result_final .= "<a href=\"display.php?id=$id\"><img src='".$images_dir. "/thumb_".$Photofilename."' /> Diver : ".$Divername." &nbsp;&nbsp;&nbsp;Location : ".$Locationname."<br><br></a> ";
    extract($row);
    }

    all gurus, my question is if 1 select the second image, $id shall be 2, how should i pass the $id to the link page, display.php.?

    please help, thank you

  2. #2
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    The way you have it there, you've got half of it right. In display.php, you need to do this:
    PHP Code:
    <?php
    $id 
    $_GET['id'];
    if (
    is_numeric($id)) {
      
    // do something with $id
    }
    else {
      
    // $id isn't a number, so something went wrong (though it shouldn't)
    }
    ?>


Bookmarks

Posting Permissions

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