title: Sumbit form with two buttons and ajax
body: <p>I have a form made with ajax, in this form there are 2 submits, both have the same function as sending an email but depending on whether the user uses one or the other the email must indicate this selection.</p>
  
  <p>I tried to use the isset function to see which of the two buttons to submit but when I receive this parameter it is empty.</p>
  
  <p><strong>HTML form</strong></p>
  
  <pre><code>&lt;form id="form-landing" data-ajax="&lt;?php echo admin_url('admin-ajax.php?action=contactlanding'); ?&gt;"&gt;
  
      &lt;?php while (have_posts()) : the_post();
          the_content();
      endwhile; ?&gt;
      &lt;?php wp_nonce_field(); ?&gt;
  
      &lt;div id="step1"&gt;
          &lt;div class="group-form"&gt;
              &lt;p&gt;1.- question 1&lt;/p&gt;
              &lt;div&gt;
                  &lt;label for="afrontarsi"&gt;Yes&lt;/label&gt;&lt;input type="radio" name="afrontar" value="Si" id="afrontarsi"&gt;
                  &lt;label for="afrontarno"&gt;No&lt;/label&gt;&lt;input type="radio" name="afrontar" value="No" id="afrontarno"&gt;
              &lt;/div&gt;
  
          &lt;/div&gt;
  
          &lt;div class="group-form"&gt;
              &lt;p&gt;2. - Question 2&lt;/p&gt;
              &lt;div&gt;
                  &lt;input type="text" name="importe" id="importe"&gt; €
              &lt;/div&gt;
          &lt;/div&gt;
  
  
          &lt;button class="send-button" name="1button" href=""&gt;Yes&lt;/button&gt;
          &lt;button class="send-button" name="2button" href=""&gt;No&lt;/button&gt;
  
  
  &lt;/form&gt;
  </code></pre>
  
  <p><strong>jQuery</strong></p>
  
  <pre><code>if(is_page_template('template-landing.php')): ?&gt;
  $('#form-landing').submit(function(e){
  
    e.preventDefault();
      var form = $(this).addClass('loading');
      var alert = form.find('.alert').removeClass('alert-danger alert-success').html('');
          $.ajax({
          url:form.data('ajax'),
          type:'POST',
          data:new FormData(this),
          processData:false,
          contentType:false,
      }).done(function(data){
          form[0].reset();
          form.find('.btn').prop('disabled',true);
          alert.addClass('alert-success').html(data);
      }).fail(function(error){
          alert.addClass('alert-danger').html(error.responseText);
  
      }).always(function(){
          form.removeClass('loading');
  
    });
  });
  &lt;?php endif;
  ?&gt;
  
  </code></pre>
  
  <p><strong>PHP function</strong> </p>
  
  <pre><code>function contactlanding(){
  
      if(check_ajax_referer()){
  
          $afrontar = sanitize_text_field($_POST['afrontar']);
          $importe = sanitize_text_field($_POST['importe']);
          if (isset($_POST['1button'])) {$button="First";} else{$button="Second";}        
  
  
          $web = parse_url(home_url(),PHP_URL_HOST);
          $message = '&lt;p&gt;&lt;strong&gt;Afrontar:&lt;/strong&gt; '.$afrontar.'&lt;/p&gt;';
          $message .= '&lt;p&gt;&lt;strong&gt;Importe:&lt;/strong&gt; '.$importe.'&lt;/p&gt;';
          $message .= '&lt;p&gt;&lt;strong&gt;Button:&lt;/strong&gt; '.$button.'&lt;/p&gt;';
  
  
          $headers  = 'MIME-Version:1.0'."\r\n";
          $headers .= 'Content-type:text/html;charset=utf-8'."\r\n";
          $headers .= 'From:noreplay@'.$web."\r\n";
          $headers .= 'Reply-To:'.$email."\r\n";
          $send = mail(get_bloginfo('admin_email'),'Mensaje enviado desde '.$web,$message,$headers);
          if($send==true){
              echo 'Gracias, tu mensaje se ha enviado correctamente.';exit;
          }
      }
      http_response_code(400);echo 'Algo salió mal, por favor intenta más tarde.';exit;
  }
  
  </code></pre>