在前台或会员中心获取表单向导里提交的数据

本文介绍如何在PHPcms v9中通过SQL查询展示表单数据,并提供了具体的代码实现,包括表单字段的展示及分页功能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

v9_form_consult为你的表单数据表,`consultman`,`question`,`username`,`datetime` 为你表单内的字段,page="$_GET"为分页代码,具体调用代码如下:
      <div class="box">
                        <h5>常见问题</h5>
        {pc:get sql="SELECT `consultman`,`question`,`username`,`datetime` FROM `v9_form_tlj` ORDER BY `datetime`" num="10" page="$_GET"}

        <table width="100%" cellspacing="1"  class="table-my">
              <thead>
                  <tr>
                  <th width="25%"><strong>问题名字</strong></th>
                  <th width="23%"><strong>订单号码</strong></th>
                  <th width="12%"><strong>报名会员</strong></th>
                                 <th width="20%"><strong>目标商家</strong></th>
                  <th width="20%"><strong>报名时间</strong></th>
                  </tr>
              </thead>
              <tbody>
                  {loop $data $r}
                  <tr>
                  <td width="25%" align="center">{$r[consultman]}</td>
                  <td width="23%" align="center">{$r[question]}</td>
                  <td width="12%" align="center">{$r[username]}</td>
                     <td width="20%" align="center">{date('Y-m-d H:i:s',$r[datetime])}</td>
                  </tr>
                  {/loop}
              </tbody>
        </table>
        {/pc}
                   <div id="pages" class="text-c">{$pages}</div>
      </div>

 

 

而phpcms v9的会员模板在menber的模块下,要添加会员申请的记录,就必须调取模板,每一个模板由控制器里(moules/content.php)不同的方法决定,所以要添加方法和模板,在方法里面连接数据库,查询表单向导对应的数据表。

再在模板里遍历出数据,使用info[表单向导字段名],就是申报的数据了。

转载于:https://my.oschina.net/u/2456768/blog/654697

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值