Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Nov 2007
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    storing values from a URL into a string

    I'm passing a specified URL to my script, something along the lines of:

    http://SOME_URL.php?model=45+&os=xp

    My script then parses the url and stores the values into an array.

    Here's my dilemma:

    I've got 4 types of models I want to pass in the URL and store that value in a variable as a string. My problem is, one of the models is "45+", but the "+" symbol isn't being saved in the string. I wonder if PHP reads it as an operator? Can anyone help with this?

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    You need to urlencode the data before you pass it through the url. I believe the + sign is read as a space in some cases.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,638
    Thanks
    2
    Thanked 404 Times in 396 Posts
    Aero is correct. The + sign is used to represent a space in URL encoding. See the manual entry for urlencode() for more information.


  •  

    Posting Permissions

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