SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Member
    Join Date
    Jan 2007
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Can't get value from link

    Hi,

    Php newbies need help....

    sample1.php
    *********
    echo "<td><a href= 'sample2.php?proid={$row['PRO_ID']}'>";
    echo $row['PRO_ID'];
    echo "</a></td>";

    sample2.php
    *********
    - the address is showing http://localhost/sample2.php?proid=123
    but I can't get the value of proid

    My code to get the value is

    $display = $_POST['proid'];
    echo $display;

    Nothing is display in my sample2.php

    Please help

  2. #2
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    $display $_GET['proid'];
    echo 
    $display
    Saul

  3. #3
    SitePoint Member
    Join Date
    Jan 2007
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by php_daemon View Post
    PHP Code:
    $display $_GET['proid'];
    echo 
    $display
    Thanks!

  4. #4
    SitePoint Addict Procode's Avatar
    Join Date
    Dec 2006
    Location
    New York
    Posts
    371
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by twotantan View Post
    Thanks!
    Remember to use $_GET when ever you need to get a var from a URL.

  5. #5
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,806
    Mentioned
    157 Post(s)
    Tagged
    3 Thread(s)
    or $_REQUEST
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  6. #6
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by spikeZ View Post
    or $_REQUEST
    Yes, Spike, but I don't think that's very good idea. $_REQUEST has the variables of $_GET, $_POST and $_COOKIES and so you have no control of where do the values come from. If for example you have a form and expect posted values, user can as well pass them through the url, and that's not a desired effect at all.

    So it's best if you use the respective variables.
    Saul

  7. #7
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,806
    Mentioned
    157 Post(s)
    Tagged
    3 Thread(s)
    Absolutely php_daemon, I dont disagree with you - it's just an alternative!
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  8. #8
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Yep, I just wanted to point out the hazards.
    Saul


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
  •