Results 1 to 3 of 3

Thread: php urlencode

  1. #1
    Join Date
    Apr 2008
    Location
    Limoges, France
    Posts
    395
    Thanks
    13
    Thanked 61 Times in 61 Posts

    Default php urlencode

    Code:
    <p><a href="http://<?php echo urlencode("maps.google.fr/maps?f=q&hl=fr&geocode=&q=limoges&sll=47.15984,2.988281&sspn=19.97465,57.128906&ie=UTF8&z=11&g=limoges&iwloc=addr"); ?>">Limoges</a> : <?php echo jd_time(); ?></p>
    This results in a hyperlink that does not work:

    Address Not Found

    Firefox can't find the server at maps.google.fr%2fmaps%3ff%3dq%26hl%3dfr%26geocode%3d%26q%3dlimoges%26sll%3d47.15984%2c2.988281%26sspn%3d19.97465%2c57.128906%26ie%3dutf8%26z%3d11%26g%3dlimoges% 26iwloc%3daddr.

    The browser could not find the host server for the provided address.

    * Did you make a mistake when typing the domain? (e.g. "ww.mozilla.org" instead of "www.mozilla.org")
    * Are you certain this domain address exists? Its registration may have expired.
    * Are you unable to browse other sites? Check your network connection and DNS server settings.
    * Is your computer or network protected by a firewall or proxy? Incorrect settings can interfere with Web browsing.

    What am I doing wrong?

    Thanks.

  2. #2
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Change the ampersands to their HTML entity equivalent.

    So, & becomes &amp;.

  3. The Following User Says Thank You to Medyman For This Useful Post:

    JasonDFR (12-22-2008)

  4. #3
    Join Date
    Apr 2008
    Location
    Limoges, France
    Posts
    395
    Thanks
    13
    Thanked 61 Times in 61 Posts

    Default

    Thanks.

    I only posted in the PHP form after realizing this might be a PHP problem rather than a HTML. Changing urlencode to htmlentities works. Thanks.

Bookmarks

Posting Permissions

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