Hi All,
I am trying to write a basic function which just uses a while loop to display a table with data returned from a select statement.
One of the columns contains a string which I want as a hyperlink. This is not a problem in itself, but I want the hyperlink to produce a pop-up.
Unfortunately it doesn't seem possible to incorporate the:
onclick="function('url?id='.$variable['name'].' ');"
into the hyperlink because there are too many apostrophes/speech marks. I also can't create this as a variable external to the function as it won't pick up the correct variable in the hyperlink.
Does anyone have a working example that I can look at, or does anyone have any advice they can give me?
Many thanks,
Embedding Javascript into PHP/HTML
Moderator: General Moderators
- CoderGoblin
- DevNet Resident
- Posts: 1425
- Joined: Tue Mar 16, 2004 10:03 am
- Location: Aachen, Germany
I think what you are after can be achieved with the escape character.
I would advise you to look up urlencode to know what is is doing and understand why you should use it.
Code: Select all
$url=urlencode("mylink?id=$variableї'name'];
echo("<a href="#" onclick="function('$url');"");
Last edited by CoderGoblin on Tue Mar 01, 2005 5:25 am, edited 1 time in total.