當在文本框中鍵入輸入並在另一個文本框中查看結果時,需要調用函數稅。我正在使用codeigniter和mysql。 我寫了一個函數稅務像我需要在文本框中鍵入值時調用函數
<?php
function tax($amount_without_tax, $tax){
$amount_with_tax = $amount_without_tax + ($tax*($amount_without_tax/100));
// work out the amount of vat
$amount_with_tax = round($amount_with_tax, 2);
return $amount_with_tax;
}
?>
,我已經喜歡
<input type="number" name="product_price"/>
我如何調用該函數時,我在上面的文本框中鍵入的東西,在另一個文本 可以顯示他們的文本框有人幫我...
您可以將php代碼轉換爲javascript並將其放在您的頁面中,或者您可以進行Ajax調用以執行計算並返回結果。 – jeff