title: submit 2 different forms in HTML using POST method
body: <p>I have 2 form in one HTML page. One form posts to a database and the other form sends an email with the details in the form. It is quite simple when I think of it, but tried for long without success.</p>
  
  <p>HTML:</p>
  
  <pre><code>    &lt;ul class="slides"&gt;
          &lt;li&gt;
              &lt;div id="contactFormContainer" class="container"&gt;
                  &lt;div class="left"&gt;
                      &lt;h1 class="uppercase"&gt;do you  have project inquiry??&lt;/h1&gt;
  
                      &lt;form id="contactForm" method="POST" name="contactForm" action=""&gt;
                          &lt;fieldset&gt;
                              &lt;p&gt; 
                                  &lt;label for="fullname"&gt;Fullname&lt;/label&gt; 
                                  &lt;input name="fullname" id="fullname" type="text"&gt;
                              &lt;/p&gt;
                              &lt;p&gt; 
                                  &lt;label for="email"&gt;Email&lt;/label&gt; 
                                  &lt;input name="email" id="contact_email" type="text"&gt;
                              &lt;/p&gt;
                              &lt;p&gt; 
                                  &lt;label for="fullname"&gt;Subject&lt;/label&gt; 
                                  &lt;input name="fullname" id="fullname" type="text"&gt;
                              &lt;/p&gt;
                              &lt;p&gt; 
                                  &lt;label for="fullname"&gt;Project Description&lt;/label&gt; 
                                  &lt;textarea name="message" id="message" rows="2" cols="20"&gt;&lt;/textarea&gt;
                              &lt;/p&gt;
                              &lt;p&gt; 
                                  &lt;input class="btn" id="contactSubmit" type="submit" value="Submit"&gt;
                              &lt;/p&gt;
                          &lt;/fieldset&gt;
                      &lt;/form&gt;     
                  &lt;/div&gt; &lt;!-- end left --&gt;
  
                  &lt;div class="right"&gt;
                      &lt;span class="head"&gt;Twitter Feeds&lt;/span&gt;
                      &lt;div class="twitter"&gt;
                          &lt;!-- twitter feed will be generated --&gt;
                      &lt;/div&gt;
                  &lt;/div&gt; &lt;!-- end right --&gt;
              &lt;/div&gt; &lt;!-- end contact form container --&gt;
          &lt;/li&gt;
  
          &lt;li&gt;
              &lt;div class="head container"&gt;
                  &lt;h2&gt;coming soon...&lt;/h2&gt;
              &lt;/div&gt;
  
              &lt;div class="body container"&gt;
                  &lt;h1 class="uppercase"&gt;Subash.com is coming with new face.&lt;/h1&gt;
                  Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Donec id elit non mi porta gravida at eget metus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Cum sociis natoque penatibus et magnis dis parturient.
              &lt;/div&gt;
  
              &lt;div class="footer container"&gt;
                  &lt;p class="signup"&gt;&lt;span class="cursive"&gt;sign up&lt;/span&gt; ..be the first to be notified&lt;/p&gt;
  
                  &lt;div class="inputbox"&gt;
                      &lt;form accept-charset="UTF-8" action="" name="subscribeForm" id="subscribeForm" method="post"&gt;
  
                          &lt;input class="email_field" id="email" name="email" placeholder="Type your email address..." type="email"&gt;
                          &lt;input class="submit_button" type="submit"&gt;
  
                      &lt;/form&gt;  
                      &lt;div class="status"&gt;
                          &lt;?php 
                              if(isset($status)){
                                  echo '&lt;p&gt;' . $status . '&lt;/p&gt;';
                              } else {
                                  echo '&lt;p class="spam"&gt;We will never spam you.&lt;/p&gt;';
                              }
                          ?&gt;
                      &lt;/div&gt;
                   &lt;/div&gt;
              &lt;/div&gt;
          &lt;/li&gt;
      &lt;/ul&gt;
  </code></pre>
  
  <p>PHP</p>
  
  <pre><code>    &lt;?php
  require_once('includes/db.php');
  require_once('includes/functions.php');
  require_once('includes/validate.php');
  
  if($_SERVER['REQUEST_METHOD'] == 'POST'){
  // subscribe form
  $email = trim($_POST['email']);
  
  if(empty($email) || !valid_email($email)){
      $status = 'Please provide valid email address.';
  } else {
      if(email_exist($email)){
          $status = 'You are already subscribed.';
      } else {
          add_email($email);
          $status = 'Thank you for subscribing.';
      }
  }   
   }
  
  require 'index.tmpl.php';
  ?&gt; 
  </code></pre>
  
  <p>This code works exactly expected. But now I need to submit the other form. I tried adding this code inside REQUEST_METHOD check following without success:</p>
  
  <pre><code>    $fullname = $_POST['fullname'];
  
  if(!empty($fullname)){
      $status = 'sucess';
      echo $status;
  } else {
      echo $fullname;
  }
  </code></pre>
  
  <p>I also tried doing:</p>
  
  <pre><code>if (!empty($_POST['contactForm'])) {
     //do something here;
  }
  
  if (!empty($_POST['subscribeForm'])) {
     //do something here;
  }
  </code></pre>
  
  <p>Is there something I am missing??</p>