2

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');">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');">Tweet this</a>

how to do so?? please help me..

3 Answers 3

2

you can just echo it in there?

<?= $markme_ddesc ?>
Sign up to request clarification or add additional context in comments.

Comments

1

You have several ways, for example:

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

or

<a href="#" onclick="window.open('http://www.twitter.com/home?status=<?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\">Tweet this</a>");

4 Comments

Can you say how they didn't work? Have you defined the $markme_ddesc variable and actually have a working php script?
Parse error: syntax error, unexpected T_STRING in /home1/tc/public_html/td/plugins/content/bookmarker.php on line 114
And i think u didnt give ) and close quotes it wont work.. I am having the PHP variable there..
Both work for me in my testing. Make sure you don't have the examples within <?php .. ?> tags!
0

Use LIKE THIS

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

note: status=<?=$markme_ddesc?>

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.