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


<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.

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.

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)

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.