欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

php求指点

程序员文章站 2022-04-21 14:26:39
...
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() 里面的单引号全部去掉,否则不能解析。
php求指点

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。

相关文章

相关视频