dougai0138 2012-06-22 21:10
浏览 14
已采纳

获取重力表格输入值

How do i get the values of specific input elements inside the gform_after_submission hook in Gravity Forms? I can get the labels with

foreach($form['fields'] as $k=>$v)
{
    $label=$form['fields'][$k]['label'];
}

but how do I get the values?

  • 写回答

1条回答 默认 最新

  • douzhaochan6468 2012-06-24 07:41
    关注

    Following the Gravity guidelines you set up the hook to call your own function - in the case below the function is after_submission().

    You can access the input values of individual form elements using their IDs like so;

    add_action("gform_after_submission", "after_submission", 10, 2);
    
    function after_submission($entry, $form){
    
        $name = $entry["2"];
        $address = $entry["17"] . ', '. $entry["18"] .', '. $entry["19"];
    
    }
    

    The IDs are all there in the form fields title in the backend, just hover over each one and it'll give you the type and ID (ie 'Single Line Text: Field ID 2).

    http://www.gravityhelp.com/documentation/page/Gform_after_submission

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
  • ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载
  • ¥15 c#逐行读取txt文本,但是每一行里面数据之间空格数量不同
  • ¥50 如何openEuler 22.03上安装配置drbd
  • ¥20 ING91680C BLE5.3 芯片怎么实现串口收发数据
  • ¥15 无线连接树莓派,无法执行update,如何解决?(相关搜索:软件下载)
  • ¥15 Windows11, backspace, enter, space键失灵