2010-04-07 75 views
2

我有一個類似下面的鏈接Href鏈接與PHP值

  <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> 

我想插入一個php變量值爲狀態事物 像

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

怎麼辦?請幫幫我..

回答

2

你可以在裏面迴應它嗎?

<?= $markme_ddesc ?> 
0

使用這樣

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

note: status=<?=$markme_ddesc?> 
1

您有幾種方法,例如:

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

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

或者(如果你是在標籤內)

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

兩者都沒有工作 – useranon 2010-04-07 12:29:28

+1

你能說他們怎麼沒有工作嗎?你有沒有定義$ markme_ddesc變量,並且實際上有一個可用的PHP腳本? – zaf 2010-04-07 12:39:33

+0

解析錯誤:語法錯誤,意想不到的T_STRING在114線/home1/tc/public_html/td/plugins/content/bookmarker.php – useranon 2010-04-07 12:47:26