Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Senior Coder doubledee's Avatar
    Join Date
    Mar 2011
    Location
    Arizona
    Posts
    1,127
    Thanks
    27
    Thanked 0 Times in 0 Posts

    Problems with Query String

    I'm having several interrelated issues with my Query String and PHP script.

    Here is a sample URL that I am working on...

    http://local.debbie/account/view-pm/incoming/


    And here is my PHP code...
    PHP Code:
        if (isset($_GET['msgview']) && $_GET['msgview']){
            
    // Message-View found in URL.

            // Set Case.
            
    $msgView strtolower($_GET['msgview']);
            echo 
    $msgView "<br />"

    When I load the URL above, my test script echoes this...
    incoming/

    Shouldn't my $_GET just be grabbing "incoming" and not the trailing slash?


    Debbie

  2. #2
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,826
    Thanks
    79
    Thanked 575 Times in 562 Posts
    Run it through basename() which will return just the name.

    http://php.net/manual/en/function.basename.php



    Example #1 basename() example
    <?php
    echo "1) ".basename("/etc/sudoers.d", ".d").PHP_EOL;
    echo "2) ".basename("/etc/passwd").PHP_EOL;
    echo "3) ".basename("/etc/").PHP_EOL;
    echo "4) ".basename(".").PHP_EOL;
    echo "5) ".basename("/");
    ?>

    The above example will output:

    1) sudoers
    2) passwd
    3) etc
    4) .
    5)
    Quote Originally Posted by deathshadow View Post
    So seriously, loosen up that tie, let out the belt, and try relating to normal people on the street instead of the gentleman's club crowd.


 

Posting Permissions

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