SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Dec 2005
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    & character not being passed on to form... please view this thread

    so i have a link:

    Code:
    <a href="javascript:void(location.href='<? echo $path; ?>?ref='+location.href)">shorten this URL</a>
    but when you visit a page that has something like ?sdsd=dsdsd&dsd=dsds ONLY tyhe part before the & charcter is passed on to the form at urlb.us (to view an example visit the site, drag and drop the bookmarklet at the bottom, and then try to use it on a php page that has more than 1 variable seperated by an &... it doesnt all get passed on)

    how can i fix this?
    Have a long, ugly URL that will break in emails or IMs?
    Make it a short url!

    learn coin magic tricks!

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,788
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    1. Don't put Javascript in the href attribute as it doesn't always work properly from there. Put in into a click event handler instead.

    2. When adding search fields to the end of a URL you should use encodeURI() to encode the search string so that characters with a special meaning don't get misinterpreted.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    SitePoint Addict ALL's Avatar
    Join Date
    Oct 2005
    Location
    South Dakota
    Posts
    215
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    i am not sure what you mean... because i just did it and it works fine.
    Did I help you?
    You can repay me, support one of my projects (no money needed):
    JavaScript Wiki, Another Web Forum, Paranormal Site


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
  •