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 Link to comment https://forums.phpfreaks.com/topic/76299-solved-php-stringsynatax-problem-prob-very-easy-to-solve/ Share on other sites More sharing options...
btherl Posted November 7, 2007 Share Posted November 7, 2007 Try this: echo '<a onclick="peoplepic(\'' .$ImageName . '\');">'; Link to comment https://forums.phpfreaks.com/topic/76299-solved-php-stringsynatax-problem-prob-very-easy-to-solve/#findComment-386253 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 Link to comment https://forums.phpfreaks.com/topic/76299-solved-php-stringsynatax-problem-prob-very-easy-to-solve/#findComment-386265 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.