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 4 of 4
  1. #1
    New to the CF scene
    Join Date
    May 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    index.php?abc ... how to get the name of "abc"

    Hi!

    This is my first message on coding forums, but I've been 'hanging out' here for a while now. I'd definitely classify myself as a beginner in PHP, but I'm learning and I learn by example so codingforums has definitely helped me out loads so far. I can't wait until I can give back to the community that's helped me so much.

    I am just experimenting in PHP at the moment, but I was wondering if it is possible to capture any variables that come in to a page that are not specific, or assigned?

    Like:

    index.php?abcdef

    or

    index.php?microsoft

    or

    index.php?special+sauce

    Would it be possible to detect that "abcdef" is in the URI (or URL.. I don't know which term to use)?

    Thanks for your help!
    Gabba

  • #2
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,465
    Thanks
    0
    Thanked 634 Times in 624 Posts
    Those would be the name of a field that doesn't have a value.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #3
    New Coder
    Join Date
    May 2007
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by gabba View Post
    Hi!

    This is my first message on coding forums, but I've been 'hanging out' here for a while now. I'd definitely classify myself as a beginner in PHP, but I'm learning and I learn by example so codingforums has definitely helped me out loads so far. I can't wait until I can give back to the community that's helped me so much.

    I am just experimenting in PHP at the moment, but I was wondering if it is possible to capture any variables that come in to a page that are not specific, or assigned?

    Like:

    index.php?abcdef

    or

    index.php?microsoft

    or

    index.php?special+sauce

    Would it be possible to detect that "abcdef" is in the URI (or URL.. I don't know which term to use)?

    Thanks for your help!
    Gabba
    Hello there!

    Not sure about what u want but have a look at this code, might do it for you!

    Code:
    <body>
    <?
    $ref = getenv("HTTP_REFERER");
    	if( strstr( $ref, "abcde" )) {
    	echo "abcde is part of the url!";
    	}
    ?>
    <form action="test.php?abcde" method="post" name="form1">
    Submit a form :
    <input name="submit" type="submit" value="Submit" />
    </form>
    </body>
    Charb

  • #4
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,040
    Thanks
    10
    Thanked 92 Times in 90 Posts
    PHP Code:
    <?echo $_SERVER['QUERY_STRING']?> would return 'abc'
    or
    <? 
    $tmp 
    array_keys($_GET);
    print_r($tmp);
    ?>
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)


  •  

    Posting Permissions

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