douyan1896 2013-08-07 05:57
浏览 61

根据选中的复选框存储数组元素?

I've got this problem that I can't solve. Partly because I can't explain it with the right terms. I'm new to this so sorry for this clumsy question.

Below you can see an overview of my goal. I am displaying my check boxes in a for loop.

Here I am getting the all values in an array, but I want store the array elements based on the check box checked.

<?php 
    $j=0;
    $arr = Array();
foreach($collection as $data) {  
    $mageid=$data['mageproductid'];
    $products = Mage::getModel('catalog/product')->load($mageid);
    $productMediaConfig = Mage::getModel('catalog/product_media_config');       
    $checkeven=0;
        $arr[$j]=$products->getId();
        //echo $arr[$j];
    $j++;
} ?>

My checkbox code:

 <form id="check_all" action="" method="POST" name="check" >
<input type="checkbox" class="multid[]" id="<?php echo $products->getId();?>"  value="checked" />  </form>

What do I have to do in order to get checked values in my array? Did I do anything wrong?

  • 写回答

3条回答 默认 最新

  • drllqg2903 2013-08-07 06:04
    关注

    After submiting the form you can get an array of checked products with $_POST['multid']

    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度