<?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 } ?>
上面的代码是导出数据到xml,我已经创建了多个表单.....这取决于数据,但我们曾经我点击图像它张贴相同的数据所以如果有人有其他的解决方案请帮助我]
如果,无论你点击什么图像,你总是得到相同的数据,这仅仅意味着你在每个表单下总是有相同的操作。
所以我将关注这一行
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']并加载适当的数据。