#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    14
    Rep Power
    0

    Pass variable in link from one PHP page to another


    So, I will go directly to the problem. I'm trying to pass a variable with a URL like this:
    PHP Code:
    echo "<a href='editImage.php?liink=$link2'>Edit</a>"
    where the variable $link2 is a link to an image. This works fine, the problem is when I'm trying to use $_REQUEST in editImage.php to catch the variable.
    In editImage.php I do this:
    PHP Code:
    $liink $_REQUEST["liink"]; 
    But $liink does not receive a value, it's empty. After this I just want to put the variable in a query and execute the query. When doing this I get this message from the browser:
    Code:
    Notice: Undefined index: liink in /path/editImage.php on line 20
    where line 20 is the above REQUEST line. I have also tried this with $_GET but it's not working.

    I have searched on the forum and on google but I can't solve this one. Please help me, I would appreciate it so much.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 2003
    Posts
    3,399
    Rep Power
    594
    $_GET is the right variable to use. Make sure the URL contains what you expect.
    PHP Code:
    echo "<pre>";
    print_r($_GET);
    echo 
    "</pre>"
    Last edited by gw1500se; January 1st, 2013 at 08:48 AM.
    There are 10 kinds of people in the world. Those that understand binary and those that don't.

IMN logo majestic logo threadwatch logo seochat tools logo