php复选框选中几条数据同时把选择的数据提交到一个页面进行修改 20
代码如下,但是我的问题是提交后不是你选择的数据,而是数据的前几条,比如你选择了3条,那么提交过去的就是前3条,如果全部选择提交过去就不会,问题在于那个for循环,怎么样添...
代码如下,但是我的问题是提交后不是你选择的数据,而是数据的前几条,比如你选择了3条,那么提交过去的就是前3条,如果全部选择提交过去就不会,问题在于那个for循环,怎么样添加一个判断哪个是选择了的,并提交
<?php
if ($_POST)
{
if($BtnSavelist)
{
if ($idList)
{
$count=count($idList);
if ($count)
{
for($i=0;$i<$count;$i++)
{
//$MSSQL->query("SELECT id FROM provide_scrapped_results WHERE storage_id='".$idList[$i]."'");
while(list($k,$v)=each($idList))
{
$MSSQL->query("INSERT INTO provide_scrapped_results (storage_id,specification_id,materials_id) VALUES ('".$idList[$i]."','".$arrspecification_id[$i]."','".$arrmaterials_id[$i]."')");
}
}
}
}
echo "<script language=javascript>";
echo "window.location=\"storage_mng_losing_edit.php?mid=$mid&specification_id=$specification_id&selectdate=$selectdate&start_date=$start_date&end_date=$end_date&P=$P&From_P=$P\"";
echo "</script>";
}
}
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<FORM METHOD="POST" NAME="form_edit" ACTION="/modules/pidgin/provide/storage_mng_losing.php">
<tr>
<td width="29%"><input type="checkbox" value="92" name="idList[]" /></td>
<td width="46%"><input type="hidden" value="1" name="arrmaterials_id[]" /></td>
<td width="25%"><input type="hidden" value="29" name="arrspecification_id[]" /></td>
</tr>
<tr>
<td><input type="checkbox" value="93" name="idList[]" /></td>
<td><input type="hidden" value="2" name="arrmaterials_id[]" /></td>
<td><input type="hidden" value="30" name="arrspecification_id[]" /></td>
</tr>
<tr>
<td><input type="checkbox" value="94" name="idList[]" /></td>
<td><input type="hidden" value="3" name="arrmaterials_id[]" /></td>
<td><input type="hidden" value="31" name="arrspecification_id[]" /></td>
</tr>
</form>
</table>
while(list($k,$v)=each($idList)) 这句是多余的,可以去除 展开
<?php
if ($_POST)
{
if($BtnSavelist)
{
if ($idList)
{
$count=count($idList);
if ($count)
{
for($i=0;$i<$count;$i++)
{
//$MSSQL->query("SELECT id FROM provide_scrapped_results WHERE storage_id='".$idList[$i]."'");
while(list($k,$v)=each($idList))
{
$MSSQL->query("INSERT INTO provide_scrapped_results (storage_id,specification_id,materials_id) VALUES ('".$idList[$i]."','".$arrspecification_id[$i]."','".$arrmaterials_id[$i]."')");
}
}
}
}
echo "<script language=javascript>";
echo "window.location=\"storage_mng_losing_edit.php?mid=$mid&specification_id=$specification_id&selectdate=$selectdate&start_date=$start_date&end_date=$end_date&P=$P&From_P=$P\"";
echo "</script>";
}
}
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<FORM METHOD="POST" NAME="form_edit" ACTION="/modules/pidgin/provide/storage_mng_losing.php">
<tr>
<td width="29%"><input type="checkbox" value="92" name="idList[]" /></td>
<td width="46%"><input type="hidden" value="1" name="arrmaterials_id[]" /></td>
<td width="25%"><input type="hidden" value="29" name="arrspecification_id[]" /></td>
</tr>
<tr>
<td><input type="checkbox" value="93" name="idList[]" /></td>
<td><input type="hidden" value="2" name="arrmaterials_id[]" /></td>
<td><input type="hidden" value="30" name="arrspecification_id[]" /></td>
</tr>
<tr>
<td><input type="checkbox" value="94" name="idList[]" /></td>
<td><input type="hidden" value="3" name="arrmaterials_id[]" /></td>
<td><input type="hidden" value="31" name="arrspecification_id[]" /></td>
</tr>
</form>
</table>
while(list($k,$v)=each($idList)) 这句是多余的,可以去除 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询