douyue1926 2015-10-25 15:26
浏览 184
已采纳

如何在WP中访问Ninja Forms用户提交的值

My client's WordPress site uses the Ninja Forms plugin for forms. There's a web page with a form that's set up to redirect to another page. I need to access the submitted form data from the redirect page, but the form values don't show up in a $_POST array on the redirect page.

Here's a Ninja Forms support page that I think provides instructions on how to achieve what I'm describing, but it's a bit over my head:

http://docs.ninjaforms.com/customer/portal/articles/1981023-processing-ninja_forms_processing

Do I need to add PHP to the form page? To the redirect page? To both?

I'd be grateful if someone who understands this page would have a look and tell me what I need to do to access the submitted form values from the redirect page.

  • 写回答

1条回答 默认 最新

  • dougan1330 2015-11-23 07:23
    关注

    If you want to access the values submitted/entered in the form fields on redirected page you can use [ninja_forms_all_fields].

    It will out put all fields values there or if you want to show a specific field value you can use [ninja_forms_field id=93]. 93 can be the ID of any field you want to access.

    If you have a template page in your theme you can write a function in your functions.php and can write what ever code you want.

    To write a function there where you must have to put the global variable $ninja_forms_processing there. Then to access a field you can write the following code:

     $value2 = $ninja_forms_processing->get_field_value( 152 );
    

    In the documentation of Ninja Forms they have clearly mentioned not to use $_POST[].

    It is the main function for interacting with both user submitted values and stored form data. Developers should use this instead of simply trying to access $_POST or $_REQUEST data. It has already been sanitized and values can be modified for use in other hooked functions.

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

报告相同问题?

悬赏问题

  • ¥15 急matlab编程仿真二阶震荡系统
  • ¥20 TEC-9的数据通路实验
  • ¥15 ue5 .3之前好好的现在只要是激活关卡就会崩溃
  • ¥50 MATLAB实现圆柱体容器内球形颗粒堆积
  • ¥15 python如何将动态的多个子列表,拼接后进行集合的交集
  • ¥20 vitis-ai量化基于pytorch框架下的yolov5模型
  • ¥15 如何实现H5在QQ平台上的二次分享卡片效果?
  • ¥15 python爬取bilibili校园招聘网站
  • ¥30 求解达问题(有红包)
  • ¥15 请解包一个pak文件