大家好日子!我是PHP編碼的新手。請問我應該怎麼做才能查看選中的複選框? 我有這樣的代碼:如何查看檢查的列表php?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<style>
.form1{
margin-left:655px;
margin-top:-150px;
}
.form2{
margin-left:655px;
margin-top:18px;
}
.form3{
margin-left:655px;
margin-top:15px;
}
.form4{
margin-left:655px;
margin-top:15px;
}
.sub{
width:100px;
height:30px;
}
</style>
<body bgcolor="#00FF99">
<center>
<br />
<?php
$ECHO = "";
function button(){
function button1(){
echo '<form method = "post" action = "" class = "form1"><td align = "center" ><input type="checkbox" name="ch1" id="checkbox"/> Check
me out</td></form>';
}
function button2(){
echo '<form method = "post" action = "" class = "form2"><td align = "center" ><input type="checkbox" name="ch[]" id="checkbox"/> Check
me out</td></form>';
}
function button3(){
echo '<form method = "post" action = "" class = "form3"><td align = "center" ><input type="checkbox" name="ch[]" id="checkbox"/> Check
me out</td></form>';
}
function button4(){
echo '<form method = "post" action = "" class = "form4"><td align = "center" ><input type="checkbox" name="ch[]" id="checkbox"/> Check
me out</td></form>';
}
}
$items = array (
'item1' => array('1001', 'Apple', 'Red Apple', 18),
'item2' => array('1002', 'Orange', 'Sweet Orange', 17),
'item3' => array('1003', 'Strawberry', 'Class A Strawberry', 30),
'item4' => array('1004', 'Mango', 'Yellow Mango', 20),
);
echo '<table width = "800" border = "0">';
echo '<tr>';
echo '<th width = "500" align = "center">ID</th>
<th width = "500" align = "center">Name</th>
<th width = "500" align = "center">Description</th>
<th width = "500" align = "center">Price</th>
<th width = "500" align = "center">ADD</th>
';
echo '<tr>';
foreach($items as $item){
foreach ($item as $s1){
echo '<td height="30" width = "90" align = "center">'.$s1.'</td>';
}
echo '</tr>';
}
echo '</table><br>';
button();
button1();
button2();
button3();
button4();
echo '<br><br><br><br>';
echo '<input type="submit" name="button" id="button" value="Submit" class="sub"/>';
?>
</center>
</body>
</html>
爲什麼你做幾種形式? – SaidbakR