treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Using just '?'

  • Hey all, I was wondering how one gets PHP pages using $_GET working with just the question mark, e.g.
    http://localhost/page/?article1

    And I've got this page to test it:
    <?php
    if(!empty($_GET)) {
    echo $_GET;
    }
    else {
    echo 'no dice';
    }
    ?>

    And when I add the "?article1" to the URL it just echoes "Array", but when I don't it just says "no dice".

    Any suggestions?
  • you need to set it equal to something..
    http://localhost/page/?article=1


    and to display what article is equal to, you need...
    <?php
    if(!empty($_GET)) {
    echo $_GET['article'];
    }
    else {
    echo 'no dice';
    }
    ?>
  • Oh. Well, that's a let down. Thanks for taking the time anyways.
  • well, this is just to the best of my knowledge.. there probably is a way to do what you're trying to do..

    since it's an Array, you can try
    print_r ($_GET);