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 8 of 8

Thread: url variable

  1. #1
    New to the CF scene
    Join Date
    Oct 2009
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    url variable

    Hello,

    I saw few site who have example url like this:

    example.com/test.php?qweqwe (notice there is no variable name and no "=")

    I'm wondering how could i do the same i tried

    PHP Code:
    <?php
    $var1 
    $_GET[NULL];
    echo 
    $var1;
    ?>
    but its not working if anyone know how to do this i would appreciate your reply.

  • #2
    Regular Coder
    Join Date
    Sep 2008
    Posts
    697
    Thanks
    8
    Thanked 17 Times in 16 Posts
    I got something like:

    test.php?message=hi

    Will that be any good?

  • #3
    New to the CF scene
    Join Date
    Oct 2009
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by bucket View Post
    I got something like:

    test.php?message=hi

    Will that be any good?
    no that's a simple $_GET['message']
    im looking for a way to do it without any variable name and "="

    edit: here an live example http://www.mediafire.com/index.php?ysj2hzetga0
    Last edited by powerfear; 10-17-2009 at 03:46 AM.

  • #4
    New Coder
    Join Date
    Aug 2009
    Posts
    26
    Thanks
    1
    Thanked 3 Times in 3 Posts
    just check out the w3schools explanation on $_GET
    http://www.w3schools.com/PHP/php_get.asp
    but i dont recomment $_GET. use url rewriting to make dynamic pages.
    just search google for url rewriting in php / apache you will see tons of tutorials on that
    scripts with lots of parameters are not Search engine friendly

  • #5
    New Coder
    Join Date
    Apr 2008
    Location
    Blagoevgrad, Bulgaria
    Posts
    47
    Thanks
    0
    Thanked 8 Times in 8 Posts
    Try to check if the $_GET['qweqwe'] is setted.

    PHP Code:
    <?php
    if (isset($_GET['qweqwe'])) {
    echo 
    "qweqwe is setted";
    }

  • #6
    met
    met is offline
    Regular Coder
    Join Date
    Oct 2009
    Location
    United Kingdom
    Posts
    728
    Thanks
    4
    Thanked 119 Times in 119 Posts
    here
    PHP Code:
    $pageURL $_SERVER["REQUEST_URI"];

    $foo explode('?'$pageURL);
    echo 
    $foo[0]; // example.com/test.php
    echo $foo[1]; //'qweqwe'; 
    go figure _^

    i had found some function to return the whole URL but it wasn't necessary.
    Last edited by met; 10-17-2009 at 11:50 AM.

  • #7
    New to the CF scene
    Join Date
    Oct 2009
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by met View Post
    here
    PHP Code:
    $pageURL $_SERVER["REQUEST_URI"];

    $foo explode('?'$pageURL);
    echo 
    $foo[0]; // example.com/test.php
    echo $foo[1]; //'qweqwe'; 
    go figure _^

    i had found some function to return the whole URL but it wasn't necessary.
    Well this work good thanks

  • #8
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    isset is the right approach, but will return false on null values. Instead, check using array_key_exists('qweqwe', $_GET);
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 


  •  

    Posting Permissions

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