title: Multiple forms on single PHP
body: <p>I am trying to create two forms on a PHP file. The processing PHP code is on the same page, but I don't know how to connect form 1 to code 1 and form 2 to code 2. I know this is probably a very basic questions, but I don't know how to do it.. Thanks! Here is my code (I only post the important part, not the connecting etc)</p>
  
  <pre><code>    &lt;div class="persinfo"&gt;
  
  &lt;?php
  
  $bday = $_POST['bday']; 
  $sex = $_POST['sex'];  
  $flighttime = $_POST['flighttime'];
  $country = $_POST['country'];
  
  $sqlupdate = "SELECT * FROM users WHERE username='$u' AND activated='1'";
  $user_query = mysqli_query($db_conx, $sqlupdate);
  
  mysqli_query($db_conx,"UPDATE users SET country='$country', bday='$bday', sex='$sex', flighttime='$flighttime' WHERE username='$u' ");
  
  ?&gt;
  
      &lt;form method="post" /&gt; 
  
          &lt;p&gt;&lt;span&gt;Country: &lt;/span&gt; &lt;input type="text" name="country" id="country" value="&lt;?php echo $country; ?&gt;"&gt;&lt;/p&gt;
          &lt;p&gt;&lt;span&gt;Gender: &lt;/span&gt;
              &lt;select name="sex" id="sex"&gt;
                  &lt;option&gt;Male&lt;/option&gt;
                  &lt;option&gt;Female&lt;/option&gt;
              &lt;/select&gt;&lt;/p&gt;
          &lt;p&gt;&lt;span&gt;Birthday: &lt;/span&gt;&lt;input type="date" name="bday" id="bday" value="&lt;?php echo $bday; ?&gt;"&gt;&lt;/p&gt;
          &lt;p&gt;&lt;span&gt;Flight experience: &lt;/span&gt;
              &lt;select name="flighttime" id="flighttime"&gt;
                   &lt;option&gt;0-500&lt;/option&gt;
                   &lt;option&gt;500-1000&lt;/option&gt;
                   &lt;option&gt;1000-5000&lt;/option&gt; 
                   &lt;option&gt;5000 +&lt;/option&gt;    
              &lt;/select&gt;&lt;/p&gt;
  
           &lt;p&gt;&lt;input  name="submit_profile" type="submit" value="Save"&gt;&lt;/p&gt;
  
      &lt;/form&gt;
  
  
      &lt;/div&gt;
  
  &lt;!-- ===== EDIT LICENSES ======= --&gt;
  
      &lt;div class="persinfo"&gt;
  
  &lt;?php
  
  $glider = $_POST['glider'];
  $commercial=$_POST['Commercial'];
  $seaplane=$_POST['seaplane'];
  $fixedwing=$_POST['fixedwing'];
  $helicopter=$_POST['helicopter'];
  $balloon=$_POST['balloon'];
  $paraglider=$_POST['paraglider'];
  $ultralight=$_POST['ultralight'];
  
  $sqlupdate = "SELECT * FROM users WHERE username='$u' AND activated='1'";
  $user_query = mysqli_query($db_conx, $sqlupdate);
  
  mysqli_query($db_conx,"UPDATE users SET glider='$glider', commercial='$commercial', seaplane='$seaplane', fixedwing='$fixedwing', helicopter='$helicopter', balloon='$balloon', ultralight='ultralight', paraglider='$paraglider'  WHERE username='$u' ");
  
  ?&gt;
  
      &lt;form method="post"/&gt; 
  
          &lt;p&gt;&lt;span&gt;Helicopter: &lt;/span&gt;&lt;input type="checkbox" name="helicopter"  id="helicopter" value="1" &lt;?php echo ($helicopter==1 ? 'checked' : '');?&gt;&gt;&lt;/p&gt;
          &lt;p&gt;&lt;span&gt;Fixed Wing: &lt;/span&gt;&lt;input type="checkbox" name="fixedwing"  id="fixedwing" value="1" &lt;?php echo ($fixedwing==1 ? 'checked' : '');?&gt;&gt;&lt;/p&gt;
          &lt;p&gt;&lt;span&gt;Commercial: &lt;/span&gt;&lt;input type="checkbox" name="commercial"  id="commercial" value="1" &lt;?php echo ($commercial==1 ? 'checked' : '');?&gt;&gt;&lt;/p&gt;
          &lt;p&gt;&lt;span&gt;Seaplane: &lt;/span&gt;&lt;input type="checkbox" name="seaplaner"  id="seaplane" value="1" &lt;?php echo ($seaplane==1 ? 'checked' : '');?&gt;&gt;&lt;/p&gt;
          &lt;p&gt;&lt;span&gt;Glider: &lt;/span&gt;&lt;input type="checkbox" name="glider"  id="glider" value="1" &lt;?php echo ($glider==1 ? 'checked' : '');?&gt;&gt;&lt;/p&gt;
          &lt;p&gt;&lt;span&gt;Para: &lt;/span&gt;&lt;input type="checkbox" name="paraglider"  id="paraglider" value="1" &lt;?php echo ($paraglider==1 ? 'checked' : '');?&gt;&gt;&lt;/p&gt;
          &lt;p&gt;&lt;span&gt;Balloon: &lt;/span&gt;&lt;input type="checkbox" name="balloon"  id="balloon" value="1" &lt;?php echo ($balloon==1 ? 'checked' : '');?&gt;&gt;&lt;/p&gt;
          &lt;p&gt;&lt;span&gt;Ultralight: &lt;/span&gt;&lt;input type="checkbox" name="ultralight"  id="ultralight" value="1" &lt;?php echo ($ultralight==1 ? 'checked' : '');?&gt;&gt;&lt;/p&gt;
  
           &lt;p&gt;&lt;input  name="submit_lic" type="submit" style="margin: 0 auto; width:100px;" value="Save"&gt;&lt;/p&gt;
  
      &lt;/form&gt;
  
      &lt;/div&gt;
  </code></pre>