我試圖讓我的複選框在頁面底部輸出「Korting is ...%」,具體取決於選中哪個複選框,例如,第二和第三盒被檢查它會輸出「Korting是15%」,但我似乎無法得到它的工作。有人可以幫我 預先感謝您無法讓PHP_SELF發佈複選框
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="nl">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>XXL Computer winkel</title>
</head>
<body>
<h3>php lab 04</h3>
<table border=0 cellpadding=0 cellspacing=0 width=100%>
<form name="orderform" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<tr>
<td>
Korting:<br />
<input type="checkbox" name="korting" value="15" /> Student 15% <br/>
<input type="checkbox" name="korting" value= "10" /> Senior 10% <br/>
<input type="checkbox" name="korting" value= "5" /> klant 5% <br/>
<hr/>
<img src="images/Lab4/1.jpg" width="200px" height="200px" alt=" "/>
<td/>
</tr>
<tr>
<td>
Toshiba Satellite A100-510 basisprijs 999.99
</td>
</tr>
<tr>
<td><!-- Shopping cart begin-->
<input type="hidden" name="toshibaproduct" value="001"/>
<input type="hidden" name="toshibamerk" value="Toshiba"/>
<input type="hidden" name="toshibamodel" value="Sattelite A100-510"/>
Aantaal: <input type="text" size=2 maxlenght=3 name="toshibaaantal" value="0"/>
<input type="hidden" name="toshibaprijs" value="999.99"/>
<input type="image" src="images/Lab4/2.jpg" border=0 value="bestellen"/>
<hr/>
</td><!--Shopping Cart END -->
</tr>
</form>
</table>
</body>
</html>
不要使用PHP_SELF。如果沒有適當的逃跑,它會打開一個XSS洞。只需使用'action =「」'代替。 – ThiefMaster
向我們顯示您的php代碼 –
您的HTML無效將會在某些瀏覽器中破壞您的表單。 [使用驗證器](http://validator.w3.org)。 – Quentin