title: HTML Button to Create text + button and then create more off that
body: <p>So I am creating a website that tracks a user's Shooting Score for Rifle Competitions. I have a Create Match tab, which brings them to a page containing a
  Weapon Selection drop down, then a Date input, then a Location input, and then I have a Save Match button which will send these three inputs to a database along with a uniqueID (primary key, auto incremented) which will allow them to distinguish which match is which.</p>
  
  <p>Now for each match you can create a String of Fire which the user can select. So on the same page, I have when the user presses Save Match, it sends the data, and then brings up another Dropdown box which houses the 4 String of Fire modes (200 yd slow, 200yd rapid, 300yd rapid, 600yd slow). And then a Create String button next to that which will bring down 10 target scores they can fill in after they push the button. the problem I am having is that when this button is pushed, it deletes the Create String dropdown box and button as well, and I'm not entirely sure what's wrong. I think it has something to do with how I'm using POST and that I am just creating a dropdown + button when they push Save Match....</p>
  
  <p>Sorry for the long block of text, I'll try to break it down more if that was too confusing.</p>
  
  <p>So basically I want to be able to push the first button (And retain w/e the user put in which I have working), and then it brings up a dropdown with 4 entries and a button, and then when that second button is created, a table of 10 entries is brought up, with a Save button, and when THAT button is pushed, it sends the 10 entries to the database. I can get the database transfer stuff working, I just need the creating more functional buttons/text inputs to work first. </p>
  
  <p>Thank you for your time!</p>
  
  <p>Code for HTML</p>
  
  <pre><code> &lt;form name="table"  action ='' method="post"&gt;
   Rifle:
   &lt;select name="wpn" id="wpn"&gt;
   &lt;option&gt;AR15&lt;/option&gt;
   &lt;option&gt;HK416&lt;/option&gt;
   &lt;option&gt;M1 Garand&lt;/option&gt;
   &lt;option&gt;M14&lt;/option&gt;
   &lt;option&gt;M4/M16&lt;/option&gt;
   &lt;option&gt;M24&lt;/option&gt;
   &lt;option&gt;SSG500&lt;/option&gt;
   &lt;option&gt;SSG556&lt;/option&gt;
  
  &lt;/select&gt;
  Date: &lt;input type="date" name = "date" id="date" value = "&lt;?php echo $_POST['date']; ?    &gt;"&gt;
  
   Location:&lt;input type="text" name="loc" id="loc" value = "&lt;?php echo $_POST['loc']; ?&gt;" /&gt;
  
  &lt;button type="submit" name = "save" value="Save Match"&gt;Save Match&lt;/button&gt;
  </code></pre>
  
  <p>Code for PHP</p>
  
  <pre><code>&lt;?php
  //if ($_SERVER['REQUEST_METHOD'] == "POST"){
  if($_POST['save'] == 'Save Match'){
      if($_POST["date"]==NULL){
          apologize("Please enter a valid date!");
      }
      else if($_POST["loc"]==NULL){
          apologize("Please enter a location!");
      }
  
  
      $id = $_SESSION['id'];
      $wpn = $_POST['wpn'];
      $date = $_POST['date'];
      $loc =$_POST['loc'];
  
  
  
      //if(isset($_POST['button'])){
          if(query("INSERT INTO matches (id, weapon, date, location) 
      VALUES (?, ?, ?, ?)",
      $id, $wpn, $date, $loc) === false){
          apologize("Sorry insertion of data failure!!!");
     }else{
         // redirect("../public/matches.php");
          //header("Location: ../public/matches.php");
  
          ?&gt;
          &lt;br /&gt;&lt;br /&gt;
  
          Strings of Fire:
          &lt;select name="mode" id="mode"&gt;
              &lt;option&gt;200 Yard Slow&lt;/option&gt;
              &lt;option&gt;200 Yard Rapid&lt;/option&gt;
              &lt;option&gt;300 Yard Rapid&lt;/option&gt;
              &lt;option&gt;600 Yard Slow&lt;/option&gt;
          &lt;/select&gt;
  
          &lt;button type="submit" name="save" value="Create String"&gt;Create String&lt;/button&gt;
          &lt;?php
          if(($_POST['save']) == 'Create String'){
              echo test;
          }
  
     }
  
  }
  ?&gt;
  &lt;/form&gt;
  </code></pre>