• Resolved dino127

    (@dino127)


    hey! Thanks for GREAT plugin and Happy Christmas to everyone!
    The task to forms builder is very simple: I wanna send the data from form to another page and according to the result to build the correspondent content. I built the form – without problem, calculate the values – without problems, inform admin and redirect to my page – without problem… but how to get the post data? ) I know that $_POST and $_REQUEST do not work and I did not find at all – how to process submitted data in v. 3? there were some fine shortcodes early, like [ninja_forms_all_fields] or global $ninja_forms_processing->get_field_value( 3 )/ And what about v.3? Understood nothing – and mainly – can not find that topic to read… I want simply to redirect form to another page and then process the got data from within functions.php, with or without shortcodes ( I will do all myself) but how… what exactly I must write in functions.php?
    Thanks in advance, I do think – that is not the problem to ninja.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor Kyle B. Johnson

    (@kbjohnson90)

    Hey @dino127,

    Here is the link that I sent you via the developer forms, for archival purposes: https://developer.ninjaforms.com/codex/submission-processing-hooks/

    Thread Starter dino127

    (@dino127)

    Hey, Kyle!
    Thanks for the respond, but it is clear, that clear nothing for now…
    Look:
    1/ if I add to functions

    add_filter( ‘ninja_forms_submit_data’, ‘my_ninja_forms_submit_data’ );

    function my_ninja_forms_submit_data( $form_data ) {
    return print_r($form_data); // just to look what is there
    }
    – nothing happen and the form is stopped with button “processing…” something wrong… and It seems to me – that the form hangs correctly : I try to use add_filter before hook apply…
    ok:
    2/ declare new shortcode in functions:

    function my_ninja_forms_submit_data( $form_data ) {
    return print_r($form_data); // just to look what is there
    }

    function ninja_process(){
    add_filter( ‘ninja_forms_submit_data’, ‘my_ninja_forms_submit_data’ );
    }

    add_shortcode( ‘test’, ‘ninja_process’ );

    I redirected ninja form to the page with [test] : everything is going on (now add_filter after apply_filter hook), but the redirected page is empty… There is no print_r($form_data)… Ok, I tried to return this way:
    function my_ninja_forms_submit_data( $form_data ) {
    print_r($form_data);
    return $form_data[ ‘fields’ ][0];
    }
    – nothing… Page is empty… How in the end THIS SHOULD WORK?.. the simplest situation, but nothing… and there are a lot of questions in web, but no answers…

    [ No bumping please. ]

    • This reply was modified 8 years, 3 months ago by dino127.
    • This reply was modified 8 years, 3 months ago by dino127.
    • This reply was modified 8 years, 3 months ago by dino127.
    • This reply was modified 8 years, 2 months ago by Jan Dembowski.
    Thread Starter dino127

    (@dino127)

    nothing understood… Who marks the questions as RESOLVED? Nothing resolved…
    Who wants me to bump the post? – I only corrected it to be more realized during 15 min. – is it a BUMP? What’s the matter with correct behavior?
    The questions as it was at once – how to proceed the sent data? The answer from the link – does not work. How to answer again?

    Thread Starter dino127

    (@dino127)

    really – I do not understand at all – the simplest question about the forms – which ninja and IS – how to handle the sent data – …. archive topics, something undeclared and unsubscribed… – that should be N1 everywhere/ Ok – I understood – u can say: it only for the money – and say this, for what aims marking resolved, bumping… WHERE ONE CAN READ about sent data handling in v.3? Difficult to write?

    Plugin Contributor Kyle B. Johnson

    (@kbjohnson90)

    The easiest way to get form data to another page is to use a redirect to a URL with query string values (using merge tags).

    ie https://site.com/another-page?name={field:name}

    This can be setup in the form builder’s Redirect Action. Then on the page that you redirect to, you can access the values from the $_GET global variable.

    ie $name = $_GET[ 'name' ];

    Also, you probably aren’t seeing anything from your dump because it is inside of an AJAX request, so executing PHP will not display directly in the browser.

    • This reply was modified 8 years, 2 months ago by Kyle B. Johnson. Reason: added links to docs for redirect
    • This reply was modified 8 years, 2 months ago by Kyle B. Johnson. Reason: added a link for post on merge tags
    Thread Starter dino127

    (@dino127)

    Yes, Kyle, this variant is working. Thank You!
    But… this approach is very… hm… unsecure, no any nonces and so on. Sure I can implement that with hidden fields. But – is it really without classes, checkers, inner implementation for POST and so on? May be – because of redirection?
    OK – what way I can handle the data at THE SAME PAGE, without redirection.
    Fine – if AJAX, – where I can read about the variables from ajax, how to handle them, because I am sure – there are not simple echo…

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to process submitted data in v.3?’ is closed to new replies.