title: HTML form submit content with PHP to .txt file - blank?
body: <p>I created a HTML form which should submit the inputted text into a .txt file with PHP, but it only creates a blank line and I don't know what the issue is.</p>
  
  <p>Help is greatly appreciated!</p>
  
  <pre><code>&lt;form class="form-inline validate" name="form1" method="post" action="signup.php" target="_blank" novalidate&gt;
      &lt;div class="row no-gutter"&gt;
          &lt;div class="col-sm-9"&gt;
              &lt;input type="email" value="" name="mail" class="form-control" placeholder="Subscribe to our newsletter" required&gt;
          &lt;/div&gt;
          &lt;div class="col-sm-3"&gt;
              &lt;input type="submit" value="SUBSCRIBE" name="Submit"&gt;
          &lt;/div&gt;
  
      &lt;/div&gt;
  &lt;/form&gt;
  
  &lt;?php
  
  $username = $_POST['user'];
  
  //the data
  
  $data = "$email\n";
  
  //open the file and choose the mode
  
  $fh = fopen("users.txt", "a");
  fwrite($fh, $data);
  
  //close the file
  
  fclose($fh);
  print "User Submitted";
  
  ?&gt;
  </code></pre>