在不测试代码的情况下,我认为问题在于表单中所需的数据结构。Gravity表单将提交的表单内容存储在如下数组中
Array
(
[form_id] => 4
[entry_id] => 58
[form_title] => Auto Bill Pay Form
[form_description] =>
[date_created] => 3/8/2015
[date_created_usa] => 8/3/2015
[pages] =>
[misc] => Array
(
[date_time] => 2015-08-03 22:17:19
[time_24hr] => 22:17
[time_12hr] => 10:17pm
[is_starred] => 0
[is_read] => 0
[ip] => 97.77.25.130
[source_url] => http://example/
[post_id] =>
[currency] => USD
[payment_status] =>
[payment_date] =>
[transaction_id] =>
[payment_amount] =>
[is_fulfilled] =>
[created_by] => 1
[transaction_type] =>
[user_agent] => Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.125 Safari/537.36
[status] => active
)
[field_descriptions] => Array
(
[17] => (Please enter subscriber’s name above if different than payment info)
[1] =>
[2] =>
[8] =>
[15] => Confirmation will be sent to the e-mail address we have on file when the transaction is complete. Please keep your e-mail address up-to-date.
[9] =>
[10] =>
[11] =>
[13] =>
[12] =>
[14] =>
)
[field] => Array
(
[17.Subscriber\'s Name] => George Washington
[17] => George Washington
[Subscriber\'s Name] => George Washington
它是一个多维数组,每个字段都有自己的ID,并有多种方式访问提交的值。
在本例中,订阅者的名称字段的字段ID为17。访问该值的最简单方法是$form[\'field\'][17]
.
在代码中,您似乎构建了一个数组$result[]
但您并不是在测试特定字段的“是”结果。
我建议var_dump()
首先检查表单结果的内容,找到要测试某个值的字段,然后从那里开始。