2014-02-20 63 views
-1

我想知道是否有可能在php中使用按鈕而不是鏈接?添加一個css按鈕到php/HTML

這裏是我的代碼。

<?php echo "<a target ='_blank' href='$prefix/$filename' >View and Download Spec Sheet .PDF </a>";?> 

我正在尋找簡單地添加一個按鈕,而不是有文字。

謝謝!

+3

什麼是CSS按鈕? – crush

+1

沒有CSS按鈕這樣的東西,但如果你想要一個CSS樣式的按鈕,那麼它是可能的。 –

回答

1

如何:

<?php echo "<form target ='_blank' action='$prefix/$filename'><button>View and Download Spec Sheet .PDF </button></form>";?> 
+0

你能解釋一下嗎?爲什麼?你投了我的答案?它完全符合提問者的要求。 – Toothbrush

+0

不是我,但你有你的形式的href。我假設這應該是'行動'? –

+0

這一個類似於我正在尋找但它不打開我正在尋找的頁面。添加ACTION完全解決了問題 – user3329725

-1

只要把一個按鈕,這樣的標籤內。這個問題應該是一個HTML問題,但不是PHP問題。

<?php echo "<a target ='_blank' href='$prefix/$filename' >View and Download Spec Sheet .PDF </a>"; ?> 
0

試試這個:

<form> 
<?php echo "<input type='button' value='your button text' onClick='window.location.href=(/"Your download location/",/"_blank/")'></input>"?> 
</form> 

希望它能幫助! 你可以在這裏添加css到你的按鈕。