从xls导出数据形成多个表格帖子]

时间:2014-07-03 14:33:31

标签: javascript php jquery html zend-framework

 <?php foreach($renewals as $row) { ?>
            <tr >
                <td style="width:50%;"><?php echo $row['renew_year']; ?></td>
                <td style="width:40%;"><?php echo $row['total']; ?></td>

                <td><a href="<?php $options['id'] = 18; echo $this->url("admin",$options); ?>?renew_year=<?php echo $row['renew_year']?>">View</a>

                </td>
                <td>
                    <input type="button" name="exportXLSRvt" id="exportXLSRvt" class="button exportIcon" title="Export XLS">
                <form id="frmExportRvt" name="frmExport" method="post"
                      action="<?php echo $this->url("admin", array("controller" => "members", "action" => "indexExport", "id" => 18)); ?>?renew_year=<?php echo $row['renew_year'] ?>"
                      style="display: none;">
                    <input type="hidden" name="hdn_export_type" id="hdn_export_type" value="xls"/>
                </form>
                </td>
            </tr>
            <?php } ?>

上面的代码是导出数据到xls我创建了多种形式.....取决于数据,但我们点击它发布相同数据的图像 所以,如果有任何身体有替代解决方案,那么请帮助我]

1 个答案:

答案 0 :(得分:0)

如果您点击的任何图片都会获得相同的数据,那么这只是意味着您在每种表单下始终采用相同的操作。

所以我将专注于这一行

 action="<?php echo $this->url("admin", array("controller" => "members", 
 "action" => "indexExport", "id" => 18)); ?>
 ?renew_year=<?php echo $row['renew_year'] ?>"

也许你必须切换到这样的东西:

 action="<?php echo $this->url("admin", array("controller" => "members", 
 "action" => "indexExport", "id" => 18, "renew_year" => $row['renew_year'])); ?>"

您应该可以从控制器调用$ _GET ['renew_year']并加载正确的数据。