Code after do_shortcode not working
-
I am trying to create a custom function in my child theme’s functions.php file.
The function executes when a webform is submitted and then I am running a shortcode to save the form’s data and transferring user to Paypal building url of all posted values of the formNow, the
do_shortcode
part works fine but it doesn’t redirect to paypalPlease help!
function process_my_form(){ if( isset( $_POST['formname'] ) ){ // process form and redirect $vars = array( 'cmd' => '_xclick', 'currency_code' =>' CAD', 'country' => 'CA', 'item_name' => 'xxxx', 'custom' => $_POST['custom'], 'amount' => '199', 'first_name' => $_POST['first_name'], 'last_name' => $_POST['last_name'], 'address1' => $_POST['address1'], 'city' => $_POST['city'], 'state' => $_POST['state'], 'zip' => $_POST['zip'], 'email' => $_POST['email'], 'phone' => $_POST['phone'], 'quantity' => $_POST['quantity'], ); echo do_shortcode( '[cfdb-save-form-post]'); header('Location: https://www.paypal.com/ca/cgi-bin/webscr?'. http_build_query($vars)); exit; } } add_action( 'init', 'process_my_form' );
Thank you
- The topic ‘Code after do_shortcode not working’ is closed to new replies.