Closed. This question is off-topic. It is not currently accepting answers.admin管理员组文章数量:1134246
Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 5 months ago.
Improve this questionI need to get form’s fields data of submitted/current form on form submission
I trying with these hooks forminator_form_after_handle_submit/forminator_form_after_save_entry
trying this
add_action( ‘forminator_form_after_save_entry’, ‘function_Name’ );
function function_Name( $form_id, $response ) {
// code here
}
but when submitting form get this issue
An error occurred while processing the form. Please try again
log error
PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function function_Name(), 1 passed in D:\xampp\htdocs\sos_wp\wp-includes\class-wp-hook.php on line 312 and exactly 2 expected in D:\xampp\htdocs\sos_wp\wp-content\themes\sos-theme\functions.php:86
can someone help with this Thanks Dinesh
Closed. This question is off-topic. It is not currently accepting answers.Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 5 months ago.
Improve this questionI need to get form’s fields data of submitted/current form on form submission
I trying with these hooks forminator_form_after_handle_submit/forminator_form_after_save_entry
trying this
add_action( ‘forminator_form_after_save_entry’, ‘function_Name’ );
function function_Name( $form_id, $response ) {
// code here
}
but when submitting form get this issue
An error occurred while processing the form. Please try again
log error
PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function function_Name(), 1 passed in D:\xampp\htdocs\sos_wp\wp-includes\class-wp-hook.php on line 312 and exactly 2 expected in D:\xampp\htdocs\sos_wp\wp-content\themes\sos-theme\functions.php:86
can someone help with this Thanks Dinesh
Share Improve this question asked Sep 14, 2023 at 16:19 DineshDinesh 1457 bronze badges 1 |2 Answers
Reset to default 3I did some more research & find this can get form feilds with $_POST
add_action( 'forminator_form_after_handle_submit', 'function_Name', 10, 2 );
add_action( 'forminator_form_after_save_entry', 'function_Name', 10, 2 );
function function_Name($form_id, $response) {
if( $response['success'] ){
error_log(print_r($_POST, true));
}
}
While I can't comment on Forminator on this stack, there is a basic mistake involving add_action
causing the error message in your log.
The cause of this is that your function requires 2 arguments to work, but you did not tell add_action
this, so it used the default 1:
add_action( string $hook_name, callable $callback, int $priority = 10, int $accepted_args = 1 ): true
https://developer.wordpress.org/reference/functions/add_action/
You need to specify that your function takes 2 arguments when using add_action
using the 4th argument, e.g.
add_action( ‘test_action’, ‘callback’, 10, 2 );
Additionally, the quotation marks in the code in your question are using smart quotes ‘...’
, use "..."
or '...'
instead
本文标签: Get form fields data on form submission using forminator plugin
版权声明:本文标题:Get form fields data on form submission using forminator plugin 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736804392a1953625.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
add_action
– Tom J Nowell ♦ Commented Sep 14, 2023 at 16:47