get values from contact form 7 wp plugin

I am using contact form 7 plugin in my blog.I am having donate option in the form with price option in radio button. user can select and submit.After submitting the form it should redirect to the paypal. with selected price .

i tried

Read More

on_sent_ok: “location =
‘https://www.sandbox.paypal.com/us/cgi-bin/webscr?cmd=_xclick&business=xxxx@india.com&currency_code=USD&amount=100&return=http://http://cratecreative.com/norpac&item_name=contribution’;”

in additional option in form management. But here value of price is static . I need to change that value what user selects.

Thanks in advance

Related posts

Leave a Reply

2 comments

  1. First change the `on_sent_ok’ to:

    on_sent_ok: 'my_redirect();'
    

    then create that my_redirect() function in the page that displays the form:

    <script>
        function my_redirect() {
            var price = document.getElementById('PRICE_FIELD').value;
            var url = 'https://www.sandbox.paypal.com/us/cgi-bin/webscr?cmd=_xclick&business=xxxx@india.com&currency_code=USD&amount='+price+'&return=http://http://cratecreative.com/norpac&item_name=contribution';
            window.location = url;
        }
    </script
    

    and done!
    Just make sure that you correct the email in that url and replace PRICE_FIELD with the actual id of the price field.

  2. This whole code goes in the additional settings box, changing the “xxxx@example.com” to your Paypal email and the "amount=100" to your own amount ex-"amount=25" or "amount="50". Also be sure to change the “return” page to your own URL once they complete the payment:

    on_sent_ok: "location = 'https://www.sandbox.paypal.com/us/cgi-bin/webscr?cmd=_xclick&business=xxxx@example.com&currency_code=USD&amount=100&return=http://http://cratecreative.com/norpac&item_name=contribution';"