• I am using contact form 7 to submit a form and generate a reference number through soap client using the wpcf7_before_send_mail.

    The code is

    function wpcf7_do_something($WPCF7_ContactForm)
    {
    
        if (3490 == $WPCF7_ContactForm->id()) {
          $client = new SoapClient('http://xxx.xxx.xxx.xxx:xxxxx/4dwsdl', array('trace' => 1));
       $res_date = date("Y-m-d", strtotime('01 feb 2015'));
       $enquiery_id = $client->__call('WS_AddContact',
           array(
               'narwal Devender',
               null,
               'Devender',
               'narwal',
               'hisar',
               'Hisar',
               'Haryana',
               '125001',
               'Australia',
               '01662246138',
               '9802260750',
               '8529000369',
               'vijaylal@webmastershisar.com',
               true,
               'google',
               'google',
               'Phone Call',
               0,
               'type of good should be strode.',
               $res_date,
               '2 to 6  Months',
               'SSPSS',
               null,//array('xxxxxxx'),
               array('46.75'),
               array('1 x 1 x 1 (1qm)'),
               array('xxxxxxxxx'),
               array('send print should be here to work.'),
               null,
               'xxxxxxxxxxxxx',
               null
           )
       );
    
    mail('vijaylal@webmastershisar.com', 'My Subject',$enquiery_id); 
    
        }
        return $wpcf7;
    }

    This is working fine and sending email.

    But I want to show the enquiry id to the custom on thankyou page or any page or by using some redirect and sending data to the url.

    I am also trying to use this code in wpcf7_mail_sent this also work,

    But when I am trying to use redirect It does nothing and contact form hangs simply.

    add_action('wpcf7_mail_sent', 'wpcf7_redirect_on_submit');
    function wpcf7_redirect_on_submit($wpcf7)
    {
            header( 'Location: http://www.google.com' );
            exit;
    }

    How can I redirect contact form in wpcf7_mail_sent without using javascript or jquery on_sent_ok?

    or

    How can I show this Enquiry id to the user on a page?

    Can anybody please help to get this work done.

  • The topic ‘How to redirect after form submission in contact form 7?’ is closed to new replies.