<form action ="jz.php" method ="post">
<br><input type ="checkbox" name ="cumtom" value="book"> 入门手册
<br><input type ="checkbox" name ="cumtom" value="hat"> 帽子
<br><input type ="submit" value="确认">你这里就已经是冲突了。解决方法是:<form action ="jz.php" method ="post">
<br><input type ="checkbox" name ="cumtom[]" value="book"> 入门手册
<br><input type ="checkbox" name ="cumtom[]" value="hat"> 帽子
<br><input type ="submit" value="确认">
以后这类内容,自己先多加几个测试点测试看看,再来问。
<br><input type ="checkbox" name ="cumtom" value="book"> 入门手册
<br><input type ="checkbox" name ="cumtom" value="hat"> 帽子
<br><input type ="submit" value="确认">你这里就已经是冲突了。解决方法是:<form action ="jz.php" method ="post">
<br><input type ="checkbox" name ="cumtom[]" value="book"> 入门手册
<br><input type ="checkbox" name ="cumtom[]" value="hat"> 帽子
<br><input type ="submit" value="确认">
以后这类内容,自己先多加几个测试点测试看看,再来问。
<input type ="checkbox" name ="cumtom[]" value="hat">$post = $_POST["cumtom"];
$list = "";
for( $i=0; $i<count($post); $i++ )
{
$list .= $post[$i];
}
$_SESSION["buylist"];
....
<br><input type ="checkbox" name ="cumtom" value="book"> 入门手册
<br><input type ="checkbox" name ="cumtom" value="hat"> 帽子
改为
<br><input type ="checkbox" name ="cumtom[]" value="book"> 入门手册
<br><input type ="checkbox" name ="cumtom[]" value="hat"> 帽子2、
if ($_POST['cumtom']=="book") {
$_SESSION['buylist'].=";book;";
}
if ($_POST['cumtom']=="hat") {
$_SESSION['buylist'].="hat;";
}$temp = $_SESSION['buylist'];
$result =split(";",$temp);改为
if ($_POST['cumtom']) {
foreach($_POST['cumtom'] as $v) {
$_SESSION['buylist'][] = $v;
}
$result = $_SESSION['buylist'];
}
<?
if (isset($_POST['book'])) {
$buylist[]="book";
}
elseif (isset($_POST['hat'])) {
$buylist[]="hat";
}
elseif (isset($_POST['shoes'])) {
$buylist[]="shoes";
}$num = count ($buylist); for ($i=0;$i<$num;$i++)
printf ("你买的商品".$buylist[$i]);print_r ($buylist);?>gm
<?
$_SESSION['name']="";
$_SESSION['buylist']="";
?><form action ="jz.php" method ="post">
<br><input type ="checkbox" name ="book" value="book"> 入门手册
<br><input type ="checkbox" name ="hat" value="hat"> 帽子
<br><input type ="checkbox" name ="shoes" value="hat">鞋子
<br><input type ="submit" value="确认">