我正在試圖製作一個計算器,它將從用戶那裏獲取輸入信息,並估計他們使用各種不同的VoIP服務會節省多少錢。基本的PHP窗體幫助
我已經設定,這樣的:
<form method="get" action="voip_calculator.php">
How much is your monthly phone bill?
<input name="monthlybill" type="text" value="$" size="8">
<p><input type="submit" name="Submit" value="Submit">
</p>
</form>
在voipcalculator.php,我指向的頁面,我想打電話給「monthlybill」,但我無法弄清楚如何做到這一點。我也不知道如何使它對行中的數字進行減法。
這對你來說可能很簡單,但這對我來說是非常令人沮喪的,我虛心地尋求一些幫助。謝謝!
這裏是voip_calculator相關的東西,你也可以點擊網址,並提交了一些,看它(在)行動。我嘗試過各種次沒有成功調用它:
<table width="100%;" border="0" cellspacing="0" cellpadding="0"class="credit_table2" >
<tr class="credit_table2_brd">
<td class="credit_table2_brd_lbl" width="100px;">Services:</td>
<td class="credit_table2_brd_lbl" width="120px;">Our Ratings:</td>
<td class="credit_table2_brd_lbl" width="155px;">Your Annual Savings:</td>
</tr>
Your monthly bill was <?php echo 'monthlybill' ?>
<?php echo "$monthlybill"; ?>
<?php echo "monthlybill"; ?>
<?php echo '$monthlybill'; ?>
<?php echo 'monthlybill'; ?>
<?php
$monthybill="monthlybill";
$re=1;
$offer ='offer'.$re.'name';
$offername= ${$offer};
while($offername!="") {
$offerlo ='offer'.$re.'logo';
$offerlogo=${$offerlo};
$offerli ='offer'.$re.'link';
$offerlink=${$offerli};
$offeran ='offer'.$re.'anchor';
$offeranchor=${$offeran};
$offerst ='offer'.$re.'star1';
$offerstar=${$offerst};
$offerbot='offer'.$re.'bottomline';
$offerbottomline=${$offerbot};
$offerca ='offer'.$re.'calcsavings';
$offercalcsavings=${$offerca};
echo '<tr >
<td >
<a href="'.$offerlink.'" target="blank">
<img src="http://www.nextadvisor.com'.$offerlogo.'" alt="'.$offername.'" />
</a>
</td>
<td >
<span class="rating_text">Rating:</span>
<span class="star_rating1">
<img src="IMAGE'.$offerstar.'" alt="" />
</span>
<br />
<div style="margin-top:5px; color:#0000FF;">
<a href="'.$offerlink.'" target="blank">Go to Site</a>
<span style="margin:0px 7px 0px 7px;">|</span>
<a href="'.$offeranchor.'">Review</a>
</div>
</td>
<td >'.$offercalcsavings.'</td>
</tr>';
$re=$re+1;
$offer ='offer'.$re.'name';
$offername= ${$offer};
}
?>
offercal(1,2,3,4,5,6,7)儲蓄調用一個名爲values.php他們在哪裏定義如下:
$offer1calcsavings="24.99";
$offer2calcsavings="20.00";
$offer3calcsavings="21.95";
$offer4calcsavings="23.95";
$offer5calcsavings="19.95";
$offer6calcsavings="23.97";
$offer7calcsavings="24.99";
我也試圖從另一個減去一個變量並顯示結果。我希望從$ offer1(2,3,4,5,6,7)calcalvings中扣除$ $每月帳單,然後顯示在該表中。應該問這是一個單獨的問題嗎? – 2008-12-04 01:19:02
@pg:是的。一旦你完成,在這裏發佈鏈接。 – nickf 2008-12-04 01:33:17
如果你正在吐輸入用戶,你真的應該或者調用htmlspecialchars()或者做某種驗證,否則你將會遇到XSS問題 – 2008-12-04 09:15:55