php求指点
时间:2021-07-01 10:21:17
帮助过:11人阅读
php求指导
实现将checkbox的值转换为01然后存入一个字段但运行有错
( ! ) SCREAM: Error suppression ignored for
( ! ) Parse error: syntax error, unexpected '=' in C:\wamp\www\whole\shiti13.php on line 20
错误提示
$username=$_SESSION['nowuser'];
$checkbox = $_POST['checkbox'];
$checkbox2 = $_POST['checkbox2'];
$checkbox3 = $_POST['checkbox3'];
$checkbox4= $_POST['checkbox4'];
$checkbox5 = $_POST['checkbox5'];
$checkbox6 = $_POST['checkbox6'];
$checkbox7 = $_POST['checkbox7'];
$checkbox8 = $_POST['checkbox8'];
$checkbox9 = $_POST['checkbox9'];
$checkbox10 = $_POST['checkbox10'];
$checkbox11 = $_POST['checkbox11'];
$checkbox12 = $_POST['checkbox12'];
$checkbox13 = $_POST['checkbox13'];
$checkbox14 = $_POST['checkbox14'];
$checkbox15= $_POST['checkbox15'];
if( $checkbox=="on"){
$checkbox=1;}
else{checkbox=o;}
if( $checkbox2=="on"){
$checkbox=1;}
else{checkbox=o;}
if( $checkbox3=="on"){
$checkbox=1;}
else{checkbox=o;}
if( $checkbox4=="on"){
$checkbox=1;}
else{checkbox=o;}
if( $checkbox5=="on"){
$checkbox=1;}
else{checkbox=o;}
if( $checkbox6=="on"){
$checkbox=1;}
else{checkbox=o;}
if( $checkbox7=="on"){
$checkbox=1;}
else{checkbox=o;}
if( $checkbox8=="on"){
$checkbox=1;}
else{checkbox=o;}
if( $checkbox9=="on"){
$checkbox=1;}
else{checkbox=o;}
if( $checkbox10=="on"){
$checkbox=1;}
else{checkbox=o;}
if( $checkbox11=="on"){
$checkbox=1;}
else{checkbox=o;}
if( $checkbox12=="on"){
$checkbox=1;}
else{checkbox=o;}
if( $checkbox13=="on"){
$checkbox=1;}
else{checkbox=o;}
if( $checkbox14=="on"){
$checkbox=1;}
else{checkbox=o;}
if( $checkbox15=="on"){
$checkbox=1;}
else{checkbox=o;}
$arr=array('$checkbox','$checkbox2','$checkbox3','$checkbox4','$checkbox5','$checkbox6','$checkbox7','$checkbox8','$checkbox9','$checkbox10','$checkbox11','$checkbox12','$checkbox13','$checkbox14','$checkbox15');
echo$array;
include('conn.php');
mysql_query( "UPDATE module1 SET 100choose = '".$arr."' WHERE username = '小和 '");
echo"提交成功";
}else{
exit('未登入!返回');
}
?>
------解决方案--------------------
所有的 else{checkbox=o;}
均应写作 else{$checkbox=0;}
------解决方案--------------------
90行是哪行?
另外,
$arr=array('$checkbox','$checkbox2','$checkbox3','$checkbox4','$checkbox5','$checkbox6','$checkbox7','$checkbox8','$checkbox9','$checkbox10','$checkbox11','$checkbox12','$checkbox13','$checkbox14','$checkbox15');
array() 里面的单引号全部去掉,否则不能解析。