split url

Discussion in 'PHP' started by googlehelper, Feb 11, 2009.

  1. #1
    say the url is http://example.com?abc=xyz&pqr=uvw

    i want to split the url into abc,xyz,pqr,uvw and check
    if abc is abc if so $var1=xyz and
    if pqr is pqr then $var2=uvw

    i think you are getting what i am sying please tell me the best way to achieve this
     
    googlehelper, Feb 11, 2009 IP
  2. crivion

    crivion Notable Member

    Messages:
    1,669
    Likes Received:
    45
    Best Answers:
    0
    Trophy Points:
    210
    Digital Goods:
    3
    #2
    what?
    use explode and $_SERVER['query_string'] functions
    also u can take a look at parse_url()
     
    crivion, Feb 12, 2009 IP
  3. osmasters

    osmasters Well-Known Member

    Messages:
    453
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    100
    #3
    I am not sure what do you want.

    If you want to get abc, pqr variables value then you can get as below
     
    osmasters, Feb 12, 2009 IP
  4. googlehelper

    googlehelper Peon

    Messages:
    57
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    this is exactly waht i want now that phpglobal is not allowed sa a user clicks on a url

    example.com/?fileurl=123456&category=phphp

    i want a variable say $filename to contain 123456 and $category to phphp but if the url is missing one of them they should not be set(only that one)

    i hope this is more clear.

    osmasters you are pretty close to what i want but will that work
     
    googlehelper, Feb 12, 2009 IP
  5. Danltn

    Danltn Well-Known Member

    Messages:
    679
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    120
    #5
    Danltn, Feb 12, 2009 IP
  6. googlehelper

    googlehelper Peon

    Messages:
    57
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    so can i use both get and post on same page
     
    googlehelper, Feb 17, 2009 IP