PHP $ _POST复选框 [英] PHP $_POST checkboxes
本文介绍了PHP $ _POST复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直在添加现有代码,我的任务是为从MySQL数据库中提取的每一行添加复选框。问题是$ _POST在我告诉它取回复选框时返回null。
这是复选框创建循环:
Hi,
I've been adding to an existing code which I have the task of adding checkboxes to each row fetched from MySQL database. The problem is that $_POST is returning a null when I tell it to fetch checked boxes.
Here's the checkbox creation loop:
<pre lang="PHP">
$RowCt = 0; //Row Counter
while($Row = mysql_fetch_assoc($Result))
{
$k = $RowCt-1;
$Table.= "<td><input id=\"chkbx".$RowCt."\" onclick=\"bindCheckbox(".$RowCt.", ".$idValues[$k].")\" type=\"checkbox\" name='chkbx[]' value=".$k.">";
//Loop thru each field
foreach($Row as $field => $value)
{
$Table.= "<td nowrap=\"nowrap\">$value</td>";
}
$Table.= "</tr>";
}
以及我想获得检查值的代码:
and the code where I want to get the checked values:
$doctorIds = $_POST['chkbx'];
//echo $doctorname;
//$q=select("SELECT * FROM `doctor` WHERE name = '$doctorname'");
//$doctorname=$q[0]['id'];
//echo $doctorname;
if (isset($doctorIds)||is_array($doctorIds)) {
foreach ($doctorIds as $key => $i){
$b=execute_sql("INSERT INTO `doctorseller`(`doctorid`, `sellerid`) VALUES ('$i','$sellerid')");
}
我有另一个表单元素,我使用相同的$ _POST方法但这给了我空的。我将不胜感激任何建议
I have another form element which i get using the same $_POST method but this is giving me nulls. I would appreciate any suggestions
推荐答案
当我告诉它取回复选框时,_POST返回null。
这是复选框创建循环:
_POST is returning a null when I tell it to fetch checked boxes.
Here's the checkbox creation loop:
<pre lang="PHP">
RowCt = 0; //行计数器
while(
RowCt = 0; //Row Counter while(
Row = mysql_fetch_assoc(
Row = mysql_fetch_assoc(
这篇关于PHP $ _POST复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文