Support

Account

Home Forums ACF PRO passing previous page content to Thank you page

Solving

passing previous page content to Thank you page

  • Hi All,

    i have a form where the <?php echo the_field(‘campaign_url’); ?> is storing a download link and i want to pass this to my Thank you page, i have this code below but it seems its not showing the link

    <?php if( get_field(‘campaign_url’, $post->ID) ): ?>
    <?php the_field(‘campaign_url’, $post->ID); ?> <!–// get content from page Y –>
    <?php endif; ?>

    can someone please help.

    Regards,
    Glenn

  • Glenn,

    Can you please be a bit more specific ? What is generating the redirect to the thank you page ? Is it a plugin, is it your own code ?

    Depending on how the redirect is defined, you could pass the post id to the thank you page, so the url should be something like http://www.site.com/thank-you/?thnq={post_id-to-retrieve}

    Then on the thank you page, you need to add some code like this:

    if ( isset( $_GET[ 'thnq' ] ) ) {
        $content_to_retrieve = get_post( $_GET[ 'thnq' ] )->post_content;
        if ( false != $content_to_retrieve ) {
            echo $content_to_retrieve;
        }
    }
  • In redirecting to the thank you page its using a javascript window.location.href after form is submitted. And pointing to a regular wordpress page i.e., Url : http://domain.com/thank-you.

    The form using eloqua so its a embedded form but the hidden field content(using ACF) that is i want to pass to the Thank You Page after submission. Is this something possible after form submit pass the content to a Thank You page?

    Regards,
    Glenn

  • Maybe I don’t quite understand… but the content you want to show is inside an ACF field on the thank you page ?

    If that’s the case you could just echo it with get_field( 'field_name' ).

  • The problem is the on Page1(Form page) is being use dynamic so the <?php echo the_field(‘campaign_url’); ?> have different content and i want to pass the content <?php echo the_field(‘campaign_url’); ?> to the thank you page but base on whats on the Page1(Form page) content. Not sure if this is clear enough.

    Already tried the session but i failed.

    Regards,
    Glenn

  • No I’m sorry. I have no clue what you mean now.

  • You will need to either create a session value https://www.ironistic.com/using-php-sessions-in-wordpress/ or pass use a query string value ?variable=value

    You will need to pass the post ID of the post that the custom field is saved to to the thank you page using one of these two methods.

    Then you can use this value to get the custom fields from that post id

    
    $value = get_field('campaign_url', $post_id);
    
  • Hi John,

    i’m quite new with ACF values/content in passing variables to other page or a thank you after Form have been submitted. if you happen to show how if possible step by step. that would be helpful

    Thanks in Advance,

  • All I can really give is suggestions at this point because I don’t have all the information I need and the code involved could be quite complex.

    What type of form are we talking about? An acf_form() or something else?

    How is this information being processed and the value saved?

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.