Activity Stream
48,167 MEMBERS
6819 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Results 1 to 5 of 5
  1.     
    #1
    Member

    Default php urlencode problem

    Hi all!

    I'm trying to create an a to z listing on my wordpress site. The letters are altering mysql query (with hyperlink and get method) so it would return only posts starting with the letter clicked by user.

    The problem is that i have characters that should not be in urls (?,Ő, etc). So, of course, the solution should be urlencode... end here comes the problem: (example)

    PHP Code: 
    $letter="?";
    $encodeit=urlencode($letter);

    echo 
    "<a href='./?letter=".$encodeit."' >Letter is: $letter </a>"
    So, my problem is with this code: the browser (both firefox and chrome) always decodes automatically the encoded letter. If i just echoing the encoded letter, i get the needed values (like %C5%90) but if i pass them to a hyperlink (so user could click them) the browser automatically decodes it (if i open the source of the page, it is encoded there too, but if i click on the hyperlink, it opens the hyperlink with the decoded character.)

    What should i do?

    ps.:
    So, for example, the created hyperlinks source code (not the above letter)
    Code: 
    <a href="./?page_id=157&amp;betu=%C5%90"><span class="azheadletter">So in the source code everything is all right</span></a>
    But after clicking on it, in the browser bar, the letter is decoded (and if i'm echoing the get parameter on the hyperlinked page, i get back the decoded character, not the encoded)
    mahjong Reviewed by mahjong on . php urlencode problem Hi all! I'm trying to create an a to z listing on my wordpress site. The letters are altering mysql query (with hyperlink and get method) so it would return only posts starting with the letter clicked by user. The problem is that i have characters that should not be in urls (?,Ő, etc). So, of course, the solution should be urlencode... end here comes the problem: (example) $letter="?"; $encodeit=urlencode($letter); Rating: 5

  2.   Sponsored Links

  3.     
    #2
    Respected Member
    Strange in my chrome it endcodes it: http://localhost/forums/?letter=%C9
    same with opera: http://localhost/forums/?letter=%C9

  4.     
    #3
    Member
    Well, i do not bother with iit anymore, it has something to do with the browsers. I just urlencoded and then urldecoded the get hoping it will work properly for others too...

  5.     
    #4
    Member
    I think u need to use html_entity encode too for unique character like that...

  6.     
    #5
    Member
    Website's:
    CoursesWeb.net MarPlo.net
    Data in $_GET and $_REQUEST encoded with urlencode() are alutomatically decoded.
    I'm not sure if it works, but anyway try the alternative function: rawurlencode() .

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. DNS problem?
    By newuploader in forum Server Management
    Replies: 7
    Last Post: 20th Nov 2011, 03:44 PM
  2. c# UrlEncode asciiArt
    By evlo in forum Web Development Area
    Replies: 1
    Last Post: 10th Aug 2011, 09:47 PM
  3. I have a problem
    By Mister XX in forum Hosting Discussion
    Replies: 3
    Last Post: 15th Apr 2011, 01:34 PM
  4. Small Footer Problem (<div> problem ??)
    By Ashleyuk1984 in forum Technical Help Desk Support
    Replies: 2
    Last Post: 26th Jan 2011, 02:53 PM
  5. KWWH side problem Or end user side problem?
    By bluedevil in forum Feedback and Suggestions
    Replies: 3
    Last Post: 24th Oct 2009, 10:07 AM

Tags for this Thread

BE SOCIAL