Jump to content

[SOLVED] php string/synatax problem - prob very easy to solve


jug

Recommended Posts

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

 

 

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

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.