title: Submit same forms with two buttons and send thank you mail only on the second submit button
body: <p>I am having the issue on submitting the same form with two submit buttons. I am submitting the form for the first time with ajax submission and on the second time I want to submit the whole form but  when I send the form the thank you mail hits two times . I want to send the thank you mail only on the second submit button and not on the first button. I have the button type ="button" ,</p>
  
  <p>Here is my form code:-</p>
  
  <pre><code>&lt;form name="basicform" id="basicform" method="post" action="&lt;?php bloginfo("template_directory"); ?&gt;/forms/callback/callback_process.php"&gt;
          &lt;input type="hidden" value="&lt;?php echo $url="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];  ?&gt;" name="source" id="source" /&gt;
          &lt;input type="hidden" value="submited" name="basicform"/&gt;
          &lt;input type="hidden" name="form_name" id="form_name" value="Header Contact Form" class="basicformname" &gt;
            &lt;div id="sf1" class="frm"&gt;
              &lt;fieldset&gt;
                &lt;!--&lt;legend&gt;Take a step for a Good health.&lt;/legend&gt;--&gt;
                &lt;div class="wor-alert"&gt;&lt;p class="text-center fill-fields"&gt;Please Fill All This Fields*&lt;/p&gt;&lt;/div&gt;
                &lt;div class="form-group"&gt;
                  &lt;div class="input-group"&gt;
                    &lt;span class="input-group-addon" id="basic-addon"&gt;&lt;i class="travcure-icon travcure-user"&gt;&lt;/i&gt;&lt;/span&gt;
                    &lt;input type="text" placeholder="Name" id="uname" name="uname" class="form-control" autocomplete="off"&gt;
                    &lt;span class="nameerr" id="unameerr"&gt;&lt;?php echo @$_SESSION['unameerr'] ? $_SESSION['unameerr']:''; unset($_SESSION['unameerr']); ?&gt;&lt;/span&gt;
                  &lt;/div&gt;
  
                &lt;/div&gt;
                &lt;div class="form-group"&gt;
  
                  &lt;div class="input-group"&gt;
                    &lt;span class="input-group-addon" id="basic-addon"&gt;&lt;i class="travcure-icon travcure-envelope"&gt;&lt;/i&gt;&lt;/span&gt;
                    &lt;input type="text" placeholder="Email" id="uemail" name="uemail" class="form-control" autocomplete="on"&gt;
                    &lt;span class="emailerr"  id="uemailerr"&gt;&lt;?php echo @$_SESSION['uemailerr'] ? $_SESSION['uemailerr']:''; unset($_SESSION['uemailer']); ?&gt;&lt;/span&gt;
                  &lt;/div&gt;
  
                &lt;/div&gt;
                &lt;div class="form-group"&gt;
                    &lt;input type="text" placeholder="Phone Number" id="uphone" name="uphone" class="uphone form-control" autocomplete="off"&gt;
                    &lt;span class="phoneerr"  id="uphoneerr"&gt;&lt;?php echo @$_SESSION['uphoneerr'] ? $_SESSION['uphoneerr']:''; unset($_SESSION['uphoneerr']); ?&gt;&lt;/span&gt;
                    &lt;input type="hidden" class="uphonefull" name="uphonefull"&gt;
                &lt;/div&gt;
                &lt;div class="form-group"&gt;
                  &lt;div class="input-group"&gt;
                    &lt;span class="input-group-addon" id="basic-addon"&gt;&lt;i class="travcure-icon travcure-user-md"&gt;&lt;/i&gt;&lt;/span&gt;
                     &lt;span class="plain-select"&gt;
                       &lt;select name="utreatments" data-style="btn-primary" id="utreatments" class="form-control selectpicker"&gt;
                        &lt;option value=""&gt;Select Treatment&lt;/option&gt;
                        &lt;option value="Alternative Treatment"&gt;Alternative Treatment&lt;/option&gt;
                        &lt;option value="2"&gt;Treatment Two&lt;/option&gt;
                        &lt;option value="3"&gt;Treatment Three&lt;/option&gt;
                        &lt;option value="4"&gt;Treatment Four&lt;/option&gt;
                        &lt;option value="5"&gt;Treatment Five&lt;/option&gt;
                      &lt;/select&gt;
                    &lt;/span&gt;
                  &lt;/div&gt;
  
                &lt;/div&gt;
  
                &lt;div class="clearfix" style="height: 10px;clear: both;"&gt;&lt;/div&gt;
  
  
                &lt;div class=" text-center"&gt;
  
                    &lt;button class="btn open1" type="button" id="head-frm-btn"&gt;Next &lt;span class="fa fa-arrow-right"&gt;&lt;/span&gt;&lt;/button&gt; 
  
                &lt;/div&gt;
  
              &lt;/fieldset&gt;
            &lt;/div&gt;
  
            &lt;div id="sf2" class="frm" style="display: none;"&gt;
              &lt;fieldset&gt;
                &lt;!--&lt;legend&gt;What treatment are you looking for?&lt;/legend&gt;--&gt;
  
                &lt;div class="form-group"&gt;
                   &lt;span class="plain-select"&gt;
                    &lt;select name="ucity" id="ucity" class="form-control"&gt;
                      &lt;option value=""&gt;Select City&lt;/option&gt;
                      &lt;option value="Mumbai"&gt;Mumbai&lt;/option&gt;
                      &lt;option value="Pune"&gt;Pune&lt;/option&gt;
                      &lt;option value="Banglore"&gt;Banglore&lt;/option&gt;
                      &lt;option value="Nagpur"&gt;Nagpur&lt;/option&gt;
                      &lt;option value="Goa"&gt;Goa&lt;/option&gt;
                    &lt;/select&gt;
                  &lt;/span&gt;
                &lt;/div&gt;
                &lt;div class="form-group"&gt;
                   &lt;span class="plain-select"&gt;
                    &lt;select name="uhospital" id="uhospital" class="form-control"&gt;
                      &lt;option value=""&gt;Select Hospital&lt;/option&gt;
                      &lt;option value="Hospital One"&gt;Hospital One&lt;/option&gt;
                      &lt;option value="Hospital Two"&gt;Hospital Two&lt;/option&gt;
                      &lt;option value="Hospital Three"&gt;Hospital Three&lt;/option&gt;
                      &lt;option value="Hospital Four"&gt;Hospital Four&lt;/option&gt;
                      &lt;option value="Hospital Five"&gt;Hospital Five&lt;/option&gt;
                    &lt;/select&gt;
                  &lt;/span&gt;
                &lt;/div&gt;
  
                &lt;div class="clearfix" style="height: 10px;clear: both;"&gt;&lt;/div&gt;
  
  
  
                &lt;div class="clearfix" style="height: 10px;clear: both;"&gt;&lt;/div&gt;
  
                &lt;div class=" text-center"&gt;
  
                    &lt;button class="btn back2" type="button"&gt;&lt;span class="fa fa-arrow-left"&gt;&lt;/span&gt; Back&lt;/button&gt; 
                    &lt;button class="btn open2" type="button" id="head-frm-btn-two"&gt;Next &lt;span class="fa fa-arrow-right"&gt;&lt;/span&gt;&lt;/button&gt; 
  
                &lt;/div&gt;
  
              &lt;/fieldset&gt;
            &lt;/div&gt;
  
            &lt;div id="sf3" class="frm" style="display: none;"&gt;
              &lt;fieldset&gt;
                &lt;!--&lt;legend&gt;Almost done&lt;/legend&gt;--&gt;
  
                &lt;div class="waittext"&gt;
                    &lt;p&gt;Our customer care executive will get in contact with you soon. Please bear with us.&lt;/p&gt;
                &lt;/div&gt;
                &lt;div class="clearfix" style="height: 10px;clear: both;"&gt;&lt;/div&gt;
  
                &lt;div class=" text-center"&gt;
  
                    &lt;button class="btn back3" type="button"&gt;&lt;span class="fa fa-arrow-left"&gt;&lt;/span&gt; Back&lt;/button&gt; 
                    &lt;input class="btn open3" value="Submit" type="submit" name="head_form_submit"&gt; 
  
  
                &lt;/div&gt;
  
              &lt;/fieldset&gt;
            &lt;/div&gt;
          &lt;/form&gt;
  </code></pre>
  
  <p>I submit this form using ajax for the first submit button and then on the second button I send the whole information  but I want to send the thank you mail on the second button and not on the ajax submission of the button. I want to get th email of both the forms but i want to send the thank you mail only on the second submit button.</p>