SitePoint Sponsor

User Tag List

Results 1 to 12 of 12
  1. #1
    SitePoint Enthusiast
    Join Date
    Jan 2001
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How ppl do this type of URL : index.php?news

    I only manage to to index.php?Page=news

    How can I do away with the page variable?

  2. #2
    SitePoint Evangelist
    Join Date
    Oct 2000
    Posts
    430
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use $QUERY_STRING or $REQUEST_URI to get the string and then perform your task

    eg

    for site.com?news/books

    $Pages = explode ("/", $QUERY_STRING);
    $Page1 = $Pages[0];
    $Page2 = $Pages[1];

    Result: -

    $Page1 = news
    $Page2 = books

  3. #3
    SitePoint Enthusiast
    Join Date
    Dec 2000
    Posts
    67
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do you know how to do this in ASP?

  4. #4
    SitePoint Evangelist
    Join Date
    Oct 2000
    Posts
    430
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry, don't know ASP but I'd guess you should look for an ASP version of $QUERY_STRING

  5. #5
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,910
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That would be something liek this:

    Request.QueryString

    Now, requesting individual variables would look like this:

    Request.QueryString("name");

    ...but I think using the first and not specifying anything will produce the whole thing. My ASP book is upstairs, so I cannot confirm things. It might be this instead:

    Request.QueryString()

    ...let me know if those work!

  6. #6
    SitePoint Enthusiast
    Join Date
    Jan 2001
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    $QUERY_STRING is a built in PHP variable ?

    Whats the difference between this and $REQUEST_URL?

  7. #7
    SitePoint Enthusiast
    Join Date
    Feb 2001
    Location
    Monmouth Junction, NJ
    Posts
    88
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well for asp help you posted this in the wrong section. if you post it in the ASP section than more hlep can be given. I onyl know this in PHP and not ASP sorry.

  8. #8
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by zhchua
    $QUERY_STRING is a built in PHP variable ?

    Whats the difference between this and $REQUEST_URL?
    Do you know you, that in the time it took you to type that post you could have written a test script to answer the question?

    PHP Code:
    <?php // test.php
    echo "request_uri = " $REQUEST_URI
    echo 
    "<br>query_string = " $QUERY_STRING
    ?>
    Throw that into your root folder and call it with this url

    http://path/to/document/root/test.php?foo=bar&baz=zoot

    Let us know what results you get
    Last edited by freakysid; Mar 15, 2001 at 19:58.

  9. #9
    SitePoint Enthusiast
    Join Date
    Jan 2001
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    request_uri =
    query_string = foo=bar&baz=zoot

  10. #10
    SitePoint Enthusiast
    Join Date
    Dec 2000
    Posts
    67
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    GoD the only reason I asked is becuase I was interested I didn't see the point in starting a new thread to ask such a similar questions.
    Besides there are so many multi talented sitepoint users............

  11. #11
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by zhchua
    request_uri =
    query_string = foo=bar&baz=zoot
    That's odd - here is my result:
    Code:
    request_uri = /test.php?foo=bar&baz=zoot
    query_string = foo=bar&baz=zoot

  12. #12
    SitePoint Enthusiast
    Join Date
    Jan 2001
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What could be wrong?


Bookmarks

Posting Permissions

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