passing by url (get method)

Sharky Forums


Results 1 to 6 of 6

Thread: passing by url (get method)

  1. #1
    Ex-*** kid A's Avatar
    Join Date
    Sep 2000
    Location
    Norway
    Posts
    5,322

    passing by url (get method)

    How would I go about it if I wanted to pass a variable (artist) that contained a value with & in it, along the url?

    I think that's what giving me a problem here, that the value is not read any further than to the & symbol in the middle of it.

    In this case the value is Billy Bragg & Wilco, and I dont think it reads the Wilco bit, hence I'm not getting the right results.

    One option is of course to use partial matching with sql (like), but I was wondering if there's something else I could do. I can't change the name of the artist because its stored in the database.

    I also cant use post method because I'm not atually submitting a form..

    Here's what the URL looks like:

    PHP Code:
    /data.php?kat=1&artist=Billy%20Bragg%20&%20Wilco&aid=287 
    Last edited by kid A; 08-28-2003 at 06:02 PM.
    Now listening to various rock and metal
    143rd member to join Sharkyforums.

  2. #2
    Hammerhead Shark
    Join Date
    Feb 2001
    Location
    Columbus, Ohio
    Posts
    1,277
    You cant use the & in the name. The & tells it to look for the next variable.

  3. #3
    Ex-*** kid A's Avatar
    Join Date
    Sep 2000
    Location
    Norway
    Posts
    5,322
    I figured as much.

    Thats why I came here for help...

    You merely confirmed my suspicion, but gave no solution, which is what I'm looking for.
    Last edited by kid A; 08-28-2003 at 10:38 PM.
    Now listening to various rock and metal
    143rd member to join Sharkyforums.

  4. #4
    Ex-*** kid A's Avatar
    Join Date
    Sep 2000
    Location
    Norway
    Posts
    5,322
    Is the urlencode function something I should look at?

    Did I mention we are speaking about PHP here...
    Now listening to various rock and metal
    143rd member to join Sharkyforums.

  5. #5
    Ursus Arctos Moderatis Grizzly's Avatar
    Join Date
    Sep 2000
    Location
    Providence, RI USA
    Posts
    3,077
    Yep yep, urlencode() and urldecode() should do you just fine.

  6. #6
    Ex-*** kid A's Avatar
    Join Date
    Sep 2000
    Location
    Norway
    Posts
    5,322
    Indeedy
    Now listening to various rock and metal
    143rd member to join Sharkyforums.

Posting Permissions

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