Title: Forward to multiple pages
Last modified: March 7, 2018

---

# Forward to multiple pages

 *  Resolved [linkshouse](https://wordpress.org/support/users/linkshouse/)
 * (@linkshouse)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/forward-to-multiple-pages/)
 * Hello,
 * I have several forms on my website and they each forward to a different page 
   on completion.
 * I am updating the site to use the dom event and for the page above this works
   fine –
 * add_action( ‘wp_footer’, ‘mycustom_wp_footer’ );
 * function mycustom_wp_footer() {
    ?> <script type=”text/javascript”> document.
   addEventListener( ‘wpcf7mailsent’, function( event ) { if ( ‘3562’ == event.detail.
   contactFormId ) { location = ‘[http://orkneyathleticclub.co.uk/payment-page-oac-10k-series-2018/&#8217](http://orkneyathleticclub.co.uk/payment-page-oac-10k-series-2018/&#8217);;}},
   false ); </script> <?php }
 * I thought that for the other pages/forms I could just add a series of else if
   statements e.g.
 * add_action( ‘wp_footer’, ‘mycustom_wp_footer’ );
 * function mycustom_wp_footer() {
    ?> <script type=”text/javascript”> document.
   addEventListener( ‘wpcf7mailsent’, function( event ) { if ( ‘3562’ == event.detail.
   contactFormId ) { location = ‘[http://orkneyathleticclub.co.uk/payment-page-oac-10k-series-2018/&#8217](http://orkneyathleticclub.co.uk/payment-page-oac-10k-series-2018/&#8217);;
   else if ( ‘2975’ == event.detail.contactFormId ) { location = ‘[http://orkneyathleticclub.co.uk/another-page/&#8217](http://orkneyathleticclub.co.uk/another-page/&#8217);;
 *  }
    }, false ); </script> <?php }
 * But when I do the above neither form forwards anymore.
 * Please could you advise.
 * Many Thanks
 * Phill
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fforward-to-multiple-pages%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [pichichi](https://wordpress.org/support/users/pichichi/)
 * (@pichichi)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/forward-to-multiple-pages/#post-10049944)
 * Not sure if this will fix it fully but the `if` statement needs a closing `}`
   before it can move to `else`.
 * So that line in your broken code block should end `2018/';}` and not `2018/';`
    -  This reply was modified 8 years, 2 months ago by [pichichi](https://wordpress.org/support/users/pichichi/).
    -  This reply was modified 8 years, 2 months ago by [pichichi](https://wordpress.org/support/users/pichichi/).
    -  This reply was modified 8 years, 2 months ago by [pichichi](https://wordpress.org/support/users/pichichi/).
 *  Thread Starter [linkshouse](https://wordpress.org/support/users/linkshouse/)
 * (@linkshouse)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/forward-to-multiple-pages/#post-10051548)
 * Doh! That fixed it.
 * Thanks [@pichichi](https://wordpress.org/support/users/pichichi/)

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Forward to multiple pages’ is closed to new replies.

 * ![](https://ps.w.org/contact-form-7/assets/icon.svg?rev=2339255)
 * [Contact Form 7](https://wordpress.org/plugins/contact-form-7/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/contact-form-7/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/contact-form-7/)
 * [Active Topics](https://wordpress.org/support/plugin/contact-form-7/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/contact-form-7/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/contact-form-7/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [linkshouse](https://wordpress.org/support/users/linkshouse/)
 * Last activity: [8 years, 2 months ago](https://wordpress.org/support/topic/forward-to-multiple-pages/#post-10051548)
 * Status: resolved