Support

Account

Home Forums General Issues Pass submission post data on submit

Helping

Pass submission post data on submit

  • I am trying to pass the post data to the redirected link so that the page is essentially the same, but instead of displaying the form, it displays thank you messaging.

    Currently using the $_POST variable to check, but it is not working.

    <?php if (empty($_POST)) : ?>
                  <?php the_content(); ?>
                  <?php
                  $fields = array(
                    'field_5d0d0b6322401',
                    'field_5d0d0bbc22403',
                    'field_5d238bd5e3433'
                  );
                  acf_register_form(array(
                    ...
                    'return'       => get_the_permalink(get_the_ID()).'?thank-you',
                    ...
                  ));
     ...
    
                <?php else : ?>
                <h2>Thank you</h2>
                <?php endif; ?>

    The post data does not appear to be passing through, as the page still loads the form after submit. Any idea of how to accomplish this?

  • The page you are redirected to will never contain _POST values. A form submission causes 2 server requests, the first to process the form, this includes the _POST values and the second to get the page you are redirecting to.

    It may contain $_GET['thank-you'] but you may need to give your query parameter a value… I’m not sure

    
    'return'       => get_the_permalink(get_the_ID()).'?thank-you=1',
    
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Pass submission post data on submit’ is closed to new replies.