改成:<?
session_start();
if ($_POST['book']=="ON") {
$_SESSION['buylist'].="book;";
}少写了个“)”

解决方案 »

  1.   

    if ($_POST['book']=="ON" {   该成if ($_POST['book'])=="ON" {
      

  2.   

    少了个),if ($_POST['book']=="ON" {改成if ($_POST['book']=="ON") {
    if ($_POST['hat']=="ON" {改成if ($_POST['hat']=="ON" ){
      

  3.   

    if ($_POST['book'])=="ON" {------------------------这样不对吧?
      

  4.   

    if ($_POST['book']=="ON" {
    ==》
    if ($_POST['book']=="ON" ){
      

  5.   

    gm.php<?
    ////$_SESSION['name']="";
    ////$_SESSION['buylist']="";
    ?><form action ="jz.php" method ="post">
    <br><input type ="checkbox" name ="book" value="ON"> 入门手册
    <br><input type ="checkbox" name ="hat" value="ON"> 帽子
    <br><input type ="submit" value="确认">
    jz.php<?session_start();
    $_SESSION['buylist']="";if ($_POST['book']=="ON") {
    $_SESSION['buylist'].="book;";
    }
    if ($_POST['hat']=="ON") {
    $_SESSION['buylist'].="hat;";
    }$temp = $_SESSION['buylist'];
    $result =split(";",$temp);$num = count ($result)-1;/////for ($i=1,$i<=$result,$i++)   ????????
     print "你买的第1个商品:".$result[0]);?>
      

  6.   

    不好意思,有一个问题忽略了,更正一下gm.php<?
    ////$_SESSION['name']="";
    ////$_SESSION['buylist']="";
    ?><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="确认">
    jz.php<?session_start();
    $_SESSION['buylist']="";if ($_POST['custom']=="book") {
    $_SESSION['buylist'].="book;";
    }
    if ($_POST['cumtom']=="hat") {
    $_SESSION['buylist'].="hat;";
    }$temp = $_SESSION['buylist'];
    $result =split(";",$temp);$num = count ($result)-1;/////for ($i=1,$i<=$result,$i++)   ????????
     print "你买的第1个商品:".$result[0]);?>
     checkbox 控件  用法上有些小问题