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 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?