Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/261.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php mysql:如何在一个表的两个不同列中提交两组复选框_Php_Html_Mysql_Checkbox - Fatal编程技术网

Php mysql:如何在一个表的两个不同列中提交两组复选框

Php mysql:如何在一个表的两个不同列中提交两组复选框,php,html,mysql,checkbox,Php,Html,Mysql,Checkbox,我有两组具有不同复选框选项的div: <div id="mobile_device" style="display:none;"> <font size="3"><b>Select the accessories :</b></font> </br></br> <input type="checkbox" name="mobile[]" value="charger"/> Charger &

我有两组具有不同复选框选项的div:

<div id="mobile_device" style="display:none;">
<font size="3"><b>Select the accessories :</b></font>
</br></br>
    <input type="checkbox" name="mobile[]" value="charger"/>  Charger &nbsp;&nbsp; &nbsp; <input type="checkbox" name="mobile[]" value="case"/> Case &nbsp;&nbsp;&nbsp;
    <input type="checkbox" name="mobile[]" value="headset"/> Headset &nbsp;&nbsp; &nbsp; <input type="checkbox" name="mobile[]" value="box"/> Box&nbsp;&nbsp; &nbsp; 
    <input type="checkbox" name="mobile[]" value="usb"/> USB Cable &nbsp;&nbsp; &nbsp; <input type="checkbox" name="mobile[]" value="sim"/> SIM<br/>
</div>

div id="desktop_device" style="display:none;">
<font size="3"><b>Select the accessories :</b></font>
</br></br>
<input type="checkbox" name="desktop[]" value="adaptor"/>  Adaptor &nbsp;&nbsp; &nbsp; <input type="checkbox" name="desktop[]" value="privacy"/> Privacy Screen &nbsp;&nbsp;&nbsp;
<input type="checkbox" name="desktop[]" value="mouse"/> Mouse &nbsp;&nbsp; &nbsp; <input type="checkbox" name="desktop[]" value="keyboard"/> Keyboard&nbsp;&nbsp; &nbsp; 
<input type="checkbox" name="desktop[]" value="connector"/> Desktop Connector <br/><br/>
</div>
但我得到了类似于“字段列表”中未知列“适配器”的错误


如何将选中的复选框值从两个div提交到两个不同的列中。

$desktop
必须作为字符串传递,因此:

$sql3= "INSERT INTO devices (type, name, serial, imei, mobile, desktop, chargerno, connectorno, monitor, monitorno) VALUES ('$type', '$name', '$serial', '$imei', '$mobile', '$desktop', $chargerno, $connectorno, $monitor, $monitorno)";

要将它们存储为字符串吗?
$sql3= "INSERT INTO devices (type, name, serial, imei, mobile, desktop, chargerno, connectorno, monitor, monitorno) VALUES ('$type', '$name', '$serial', '$imei', '$mobile', '$desktop', $chargerno, $connectorno, $monitor, $monitorno)";