【发布时间】:2018-06-04 00:49:15
【问题描述】:
我需要制作一个按钮,单击该按钮会将页面上 HTML 表单中的所有数据导出到 excel 文件中。谁能帮我解决这个问题,我是 PHP 新手,不知道从哪里开始。
<div class="left col-md-12 form-group" >
<form method="post" id="triallesson_form">
<div class="table">
<table class="table table-header-rotated table-condensed table-striped table-hover" style="width: 100%;">
<th></th>
<th class="col-xs-1 not-rotate"><div><span><?= text::$string['person_name'] ;?></span></div> </th>
<th class="col-xs-1 not-rotate"><div><span><?= text::$string['person_telphone'] ;?></span></div> </th>
<th class="col-xs-1 not-rotate"><div><span><?= text::$string['location_name'] ;?></span></div> </th>
<th class="col-xs-3 not-rotate"><div><span><?= text::$string['class_date'] ;?></span></div> </th>
<th class="col-xs-2 not-rotate"><div><span><?= text::$string['triallesson_type'] ;?></span></div> </th>
<th class="col-xs-2 not-rotate"><div><span><?= text::$string['triallesson_email'] ;?></span></div> </th>
<th class="col-xs-2 not-rotate"><div><span>via</span></div> </th>
<th class="rotate-45"><div><span><?= text::$string['triallesson_called'] ;?></span></div> </th>
<th class="rotate-45"><div><span><?= text::$string['triallesson_confirmd'] ;?></span></div> </th>
<th class="rotate-45"><div><span><?= text::$string['triallesson_show'] ;?></span></div> </th>
<th class="rotate-45"><div><span><?= text::$string['triallesson_sign_up'] ;?></span></div> </th>
<th class="rotate-45"><div><span><?= text::$string['triallesson_cancelled'] ;?></span></div> </th>
<th class="rotate-45" title="<?= Text::$string['triallesson_sms_info'];?>"><div><span><?= Text::$string['triallesson_sms'] ;?></span></div> </th>
<th></th>
<?= $content[1]; ?>
</table>
<input type="hidden" name="date1" value="<?=$con->date1?>">
<input type="hidden" name="date2" value="<?=$con->date2?>"></form>
</div>
</div>
上次我没有添加代码对不起。 这是我的数据将在其中显示的表格。 我的意图是,当我单击同一页面上的按钮时,它将从表中获取所有数据并将其导出到 XLS 或 CSV 文件中。
如果需要任何进一步的信息,我会添加它,提前谢谢你。
【问题讨论】:
-
你做了什么。这不是我们将提供免费服务的网站。至少尝试一下并向我们展示您遇到问题的代码,以便我们为您提供帮助。
-
有关提示,请参阅一些 jquery 方法。我使用 jquery 在 excel 中下载数据。尝试下载一些 jquery 代码,如果您遇到困难,请来这里提供代码,以便我们为您提供帮助。
-
php 不提供这种类型的特殊按钮。看这里stackoverflow.com/questions/4249432/export-to-csv-via-php
-
您能否为您的问题添加更多细节?您要捕获什么 - 当前在 input/textareas/selects 等中的内容?您是否想在按下“提交”按钮时执行此操作(例如) - 或者您是否想将表单中的信息存储到数据库中,然后从那里导出?
-
@doublesidestickytape 嘿,对不起,我有点不清楚。我编辑了我的问题。我希望现在更清楚了。
标签: php html excel forms button