我想擺脫索引undefined。每次點擊提交而未勾選框,我都會收到未定義的索引錯誤。
<html>
<head>
<title>Order</Title>
<style>
</style>
<body>
<form action = "order.php" method = "post">
Coffee:<p>
<input type = "checkbox" value = "coffee" name = "cappuccino"/>Capuccino<br>
</form>
</body>
</head>
</Html>
<?php
$capuccino = 3.75;
if(isset($_POST["submit"]))
{
if($_POST['cappuccino'] <> 'coffee')
{
$capuccino = 0;
}
}
?>
使用'isset'? –