www.webdeveloper.com
Results 1 to 6 of 6

Thread: Using comma in URL

  1. #1
    Join Date
    Jan 2007
    Posts
    69

    Using comma in URL

    I have seen many urls like index.php?page=main,id=123 But my Url is like page=main&id=123

    How can I change & to a comma in URL in PHP.

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,537
    I suppose you could do it at the web server level with url rewriting, though it seems an unnecessary extra bit of effort and processing just to change one punctuation character to another.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  3. #3
    Join Date
    Jan 2007
    Posts
    69
    Here is the code

    PHP Code:
    <? if (isset($_GET['act'])) $PAGE $_GET['act']; # You can change the value between the brackets to change the index.php?xxx #

    else $PAGE 'home';  # When no page is being asked for, it will default to home. See below!

    switch ($PAGE) {
    //1- index
    case 'home':   # value to call , index.php?xxx=home
    include ('home.php'); # path to file
    break;

    //2-about
    case 'about':  # value to call , index.php?xxx=about
    include ('/about/about.htm');  # path to file
    break;

    default:
    echo 
    "<p align=center>Error 404! the page you request doesn't exist or as been temporarily inaccessible </p>"# Page request not found
    break;
    ?>

  4. #4
    Join Date
    Jan 2007
    Posts
    69
    I want the URL with comma

    index.php?page=videos,videoid=9,cagegory=funny

    Is there anyone who knows how to do it ?

  5. #5
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,537
    You'll have to grab the entire query string from the URL and parse it yourself, probably from the $_SERVER['QUERY_STRING'] super-global. Life will be a lot easier for you though if you follow the same protocol that 99.999% of the web follows and use the HHTP standard "&" character as your key=value pair separator, and just grab them from the $_GET array.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  6. #6
    Join Date
    Jan 2007
    Posts
    69
    Thanks for the info.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles