jug Posted November 7, 2007 Share Posted November 7, 2007 Hi, has anyone any ideas on what is the correct syntax for this piece of code echo '<a onclick="peoplepic("' .$ImageName . '");">'; ive tried many things but had had no luck. Basically im echo-ing out a link with an onclick javascript event where the passed parameter is an php string coming from a database. This lines needs to be echo-ed because it is in a while loop. Any help would be much appreciated. Im pretty out of ideas Thanks in advance - jug Quote Link to comment Share on other sites More sharing options...
btherl Posted November 7, 2007 Share Posted November 7, 2007 Try this: echo '<a onclick="peoplepic(\'' .$ImageName . '\');">'; Quote Link to comment Share on other sites More sharing options...
jug Posted November 7, 2007 Author Share Posted November 7, 2007 Thanks very much for your quick reply. Ive actually got it working now through plain determination. Your solution looks right and im sure it works but i got it working the other way where all the quotes are the other way around. I dont think theres any difference. I never knew you could escape quotes in strings so its very useful to know. SOLUTION = echo "<a onclick='peoplepic(\"$ImageName\");'>"; Thanks again - jug Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.