passing value in url

Discussion in 'PHP' started by rahuldas14, Mar 25, 2010.

  1. #1
    I want to pass a value through url in php. Can anyone please help me regarding this please.

    eg www.xyd.com/?variable=value
    and i print out: value

    I hope you got my point.
     
    rahuldas14, Mar 25, 2010 IP
  2. mnvlxxx

    mnvlxxx Peon

    Messages:
    47
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    In the destination page put this:

    
    <? echo $_GET['variable']; ?>
    
    PHP:
     
    mnvlxxx, Mar 25, 2010 IP
  3. danx10

    danx10 Peon

    Messages:
    1,179
    Likes Received:
    44
    Best Answers:
    2
    Trophy Points:
    0
    #3
    To ellaborate on mnvlxxx, the destination page would be index.php (unless your using url rewriting/mod rewrite):

    <?php
    echo $_GET['variable']; 
    ?>
    PHP:
    Also @ mnvlxxx,
    get use to using full php tags, as not on every server/host is short tags enabled - such as some shared. (or situations where you don't have access to php.ini etc.).
     
    Last edited: Mar 25, 2010
    danx10, Mar 25, 2010 IP
  4. mnvlxxx

    mnvlxxx Peon

    Messages:
    47
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    You are totally right! Thanks for the correction.
     
    mnvlxxx, Mar 25, 2010 IP