WordPress Contact Form 7 pass POST vars to thanks page

I am trying to use Contact Form 7 to redirect the user to a new page that thanks them and offers more info once the form has successfully been filled.

How can I pass the $_POST[] vars through? I couldn’t find anything on Google.

Read More

Edit:

I am also trying to use the form to pre-populate a PayPal buy it now button.

Related posts

Leave a Reply

1 comment

  1. According to Contact Form 7 documentation you have to set a JavaScript action hook. By using this hook, you can specify a JavaScript code that you wish to run after the form is successfully submitted. You will find the Additional Settings field at the bottom of the contact form management page. Simply insert the following line into it:

    on_sent_ok: "your javascript code;"
    

    If you want you can use following code to redirect to a new page with variables but it will send the variables to the $_GET

    on_sent_ok: "location = 'http://yourdomain.com?myVar=somevalue';"
    

    You can retrieve the variable as follows

    $myVar = $_GET['myVar'];
    

    Read more, also check add_query_arg.