HELP - Pretty simple PHP Question

Discussion in 'PHP' started by qardinal, Nov 14, 2008.

  1. atlantaazfinest

    atlantaazfinest Peon

    Messages:
    389
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #21
    How about just using decode thats what the function was made for.

    $variable = urldecode($_SERVER['QUERY_STRING']);
    and the do whatever with $variable.
     
    atlantaazfinest, Nov 14, 2008 IP
    qardinal likes this.
  2. ads2help

    ads2help Peon

    Messages:
    2,142
    Likes Received:
    67
    Best Answers:
    1
    Trophy Points:
    0
    #22
    Why don't we just use this (i said at post #11)

    print urldecode($_SERVER['QUERY_STRING']);
    PHP:
    it returns lol there for yourfile.php?lol there
     
    ads2help, Nov 14, 2008 IP
    qardinal likes this.
  3. atlantaazfinest

    atlantaazfinest Peon

    Messages:
    389
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #23
    lol exactly what i just said LMFAO!!
     
    atlantaazfinest, Nov 14, 2008 IP
  4. ads2help

    ads2help Peon

    Messages:
    2,142
    Likes Received:
    67
    Best Answers:
    1
    Trophy Points:
    0
    #24
    lol i didn't notice that LOL
     
    ads2help, Nov 14, 2008 IP
  5. qardinal

    qardinal Peon

    Messages:
    333
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #25
    Just wanted to let all of you know that I've tried every suggestion, here are my results:



    
    print($_GET[v]);
    
    Code (markup):
    This reproduces almost all text, except "#", where it stops reproducing text. Also, it adds a slash for words like "it's" Ex: file.php?v=adrian peterson's # is 28
    This will show "adrian peterson\'s", nothing further, the "#" cuts it off.



    
    <?
    foreach ($_GET as $key=>$value) {
        echo $key;
    }
    ?>
    
    This adds an underscore instead of spaces.
    
    The replacement text:
    <?
    foreach ($_GET as $key=>$value) {
        echo str_replace("_"," ",$key);
    }
    ?>
    
    Removes all spaces, a string like page.php?hey there 
    is reproduced as "heythere"
    
    Code (markup):
    
    print urldecode($_SERVER['QUERY_STRING']);
    
    This is the best alternative so far, it's short which makes it easier to
     implement.  It's only draw back is it stops reproducing text at 
    the "#" symbol.  I think that's the one I'll use from now on
    
    Code (markup):
    Thank all of you for your help, +rep all around!
     
    qardinal, Nov 14, 2008 IP
  6. logondotinfo

    logondotinfo Peon

    Messages:
    314
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    0
    #26
    the # symbol is a special character in urls as it is used for anchor urls (i.e. to link to a specific point within a web page) You will need to be exceptionally careful if you are going to want to use # in urls for anything other than this purpose. glad the other code snippets helped though :)
     
    logondotinfo, Nov 16, 2008 IP
  7. osocash

    osocash Member

    Messages:
    49
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #27
    great stuff, just learnd something good

    thanks mates
     
    osocash, Nov 18, 2008 IP