SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Guru
    Join Date
    Feb 2006
    Location
    Chepstow, South Wales
    Posts
    906
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    add ?id to end of href whilst calling a javascript pop up form

    What I have is a button on my page that when clicks, calls a pop up and then my client can request details from the page they are on.

    Each page has a unique id, so im trying to pass that id to the other page to read it.

    I'm not sure where to post this to be honest, as its a mixture of html, javascript and php.

    The code is as follows

    PHP Code:
    <a href='javascript:fg_popup_form("fg_formContainer","fg_form_InnerContainer","fg_backgroundpopup")?Id_Hot=<?=$rows['Id_Hot']?>'>
    The ?Id_Hot bit is not allowing it to work.

    If not here I will post it in the other forums, if its isnt right here.

  2. #2
    Non-Member
    Join Date
    Apr 2011
    Location
    no fixed address
    Posts
    851
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What are you really trying to do??

    You are calling a function from a href (which you shouldn't do, but that's another issue) and the function call appears to have a query string appended to it which is not allowed.

  3. #3
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    69 Post(s)
    Tagged
    0 Thread(s)
    window.open can take query strings, but what you're doing there is... something altogether different, and using a function that you havent shown us. As webdev said, this shouldnt be inside the href attribute (rather, it should be in the onClick attribute)

  4. #4
    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)
    Most JavaScript will not work properly if incorrectly included in an href attribute.

    JavaScript certainly isn't going to work if you stick a ?id on the end of the script as >id is not valid JavaScript.

    You ought to be attaching the script via the click event and adding the id to the url you send to location.href within the JavasScript function itself.

    The href attribute should contain a link to where you want those people without JavaScript to go when they click the link.
    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="^$">


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
  •