Results 1 to 4 of 4

Thread: [RESOLVED] $_GET['year] -- ?sort=alpha?year=2006

  1. #1

    Thread Starter
    PowerPoster kfcSmitty's Avatar
    Join Date
    May 2005
    Posts
    2,248

    Resolved [RESOLVED] $_GET['year] -- ?sort=alpha?year=2006

    I am trying to use 2 GET variables in some code I am doing.

    First get is $_GET['sort'];
    Second is $_GET['year'];


    But sort pulls out "alpha?year=2006"

    Anyone know how to get around this?

  2. #2

    Thread Starter
    PowerPoster kfcSmitty's Avatar
    Join Date
    May 2005
    Posts
    2,248

    Re: $_GET['year] -- ?sort=alpha?year=2006

    Updated a little: I am trying ot access it with this link

    ?page=alphabetical#?year=2006


    $_GET['year'] doesnt grab anything. If i hard code the 2006 the query works. So all I have to do is figure out how to get it to grab year now..

  3. #3
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: $_GET['year] -- ?sort=alpha?year=2006

    The URL is invalid.
    A http URL may only contain a single ?. It marks the start of the query string. The query string can be anything, but typically it is a series of name=value pairs separated by &.
    The # character marks the start of the fragment identifier. It is not part of the server-side resource locator (i.e. the server is not allowed to send different things depending on it) and will, in fact, not be sent by most browers but instead interpreted locally.
    The URL you want is
    "http://www.example.com/path/to/page.php?sort=alphabetical&year=2006"
    Of course, if you put that into a hyperlink's href attribute (or anywhere else in the HTML with the exception of script elements), you must escape each & to &.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  4. #4

    Thread Starter
    PowerPoster kfcSmitty's Avatar
    Join Date
    May 2005
    Posts
    2,248

    Re: $_GET['year] -- ?sort=alpha?year=2006

    Thanks for the tip. I got it working just before reading this actually..heh.


    Although I used the delimiter : rather than &

Posting Permissions

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



Click Here to Expand Forum to Full Width