tags:

views:

232

answers:

3

hi i am having a link like below

        <a href="#" onclick="window.open('http://www.twitter.com/home?status=Reading+Facebook share, Yahoo Buzz and Tweet this buttons for Blogger blogs+http://www.didiknow.com');"&gt;Tweet this</a>

i want to insert a php variable value inside for the status thing like

          <a href="#" onclick="window.open('http://www.twitter.com/home?status=$markme_ddesc');"&gt;Tweet this</a>

how to do so?? please help me..

+2  A: 

you can just echo it in there?

<?= $markme_ddesc ?>
douwe
A: 

Use LIKE THIS

<a href="#" onclick="window.open('http://www.twitter.com/home?status=&lt;?=$markme_ddesc?&gt;"&gt;Tweet this</a>

note: status=<?=$markme_ddesc?>
nik
+1  A: 

You have several ways, for example:

<a href="#" onclick="window.open('http://www.twitter.com/home?status=&lt;?=$markme_ddesc?&gt;"&gt;Tweet this</a>

or

<a href="#" onclick="window.open('http://www.twitter.com/home?status=&lt;?php print($markme_ddesc);?>">Tweet this</a>

or (in case you are within the tags)

print("<a href=\"#\" onclick=\"window.open('http://www.twitter.com/home?status=$markme_ddesc\"&gt;Tweet this</a>");
zaf
both didnt worked
Aruna
Can you say how they didn't work? Have you defined the $markme_ddesc variable and actually have a working php script?
zaf
Parse error: syntax error, unexpected T_STRING in /home1/tc/public_html/td/plugins/content/bookmarker.php on line 114
Aruna
And i think u didnt give ) and close quotes it wont work.. I am having the PHP variable there..
Aruna
Both work for me in my testing. Make sure you don't have the examples within <?php .. ?> tags!
zaf