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

 

 

Link to comment
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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