Title: Code after do_shortcode not working
Last modified: October 7, 2016

---

# Code after do_shortcode not working

 *  [darshan1989](https://wordpress.org/support/users/darshan1989/)
 * (@darshan1989)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/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 form
 * Now, the `do_shortcode` part works fine but it doesn’t redirect to paypal
 * Please 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.

## Tags

 * [custom function](https://wordpress.org/support/topic-tag/custom-function/)
 * [do_shortcode](https://wordpress.org/support/topic-tag/do_shortcode/)

 * 0 replies
 * 1 participant
 * Last reply from: [darshan1989](https://wordpress.org/support/users/darshan1989/)
 * Last activity: [9 years, 7 months ago](https://wordpress.org/support/topic/code-after-do_shortcode-not-working/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
