duanbipu1720 2013-10-01 23:17
浏览 16
已采纳

如何获得多个复选框的REAL值?

I have a multiple checkbox in my html table with $number as index ">

I get the value of the multiple checkbox:

$checklist = $_POST['checkbox'];

The value of the $checklist are correct when i do echo.

$i = $checklist[0];
echo $i; // 2 for example

Now i try to get the node number $i (2) in my xml file

$participants = simplexml_load_file($fileName); Then this line echo $participants->participant[$i]->name; display blank

Or if define $j = 2; then echo $participants->participant[$j]->name; display the name of the participant 3 ($j + 1) and that is correct.

That mean $check or $i = $checklist[0]; don't give a simple number like $j, any idea please ? Thanks in advance.

  • 写回答

1条回答 默认 最新

  • doupai5450 2013-10-02 07:18
    关注

    The problem is just because php type the variable, so $check is not int type, $j is int type. Just do $i= (int)$check and it works well when doing $participants->participant[$i]->name; Thansk for your participation.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大