2014-03-19 17:07
浏览 55


This seems like it should be a fairly easy question, but Google is not yielding results.

I'm writing a WordPress plugin that processes data from Gravity Forms after the submission is complete. I'm using the gform_after_submission hook.

This passes an "Entry Object" to my function for processing. Most of the values I can extract just fine. So for example:

$eventDate = $e[2];

...Works just fine. This is a date field. All I have to do is pull the value out of the entry object with the proper index.

My issue is getting the value of a particular checkbox. I need to see if it was checked or not.

This doesn't work:

$checkbox = $e[4];

I'm guessing it's because a checkbox field can have multiple values. Unfortunately I'm not sure how to get to the value of each specific checkbox.

Thank you in advance for your help!

图片转代码服务由CSDN问答提供 功能建议


我正在编写一个WordPress插件,在提交完成后处理来自Gravity Forms的数据。 我正在使用 gform_after_submission 钩子。

这会将“Entry Object”传递给我的函数进行处理。 我能提取的大多数值都很好。 例如:

$ eventDate = $ e [2];

...工作正常。 这是一个日期字段。 我所要做的就是使用适当的索引从入口对象中提取值。

我的问题是获取特定复选框的值。 我需要查看它是否被检查过。


$ checkbox = $ e [4] ;

我猜这是因为复选框字段可以有多个值。 不幸的是,我不确定如何获得每个特定复选框的值。


  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • douqi5079 2014-03-19 18:17

    If no checkbox value is set manually, the variable will have the value "on". Please do a var_dump($e); and post the result.

    打赏 评论

相关推荐 更多相似问题