title: Saving user Input?
body: <p>How do I save my user input to a simple .txt?</p>
  
  <p>I am really new to php so please help me out here.</p>
  
  <p>My code:</p>
  
  <pre><code> &lt;?php
  if(isset($_POST['email']) &amp;&amp; isset($_POST['password'])) {
      $data = $_POST['email'] . '-' . $_POST['password'] . "\n";
      $ret = file_put_contents('/tmp/mydata.txt', $data, FILE_APPEND | LOCK_EX);
      if($ret === false) {
          die('There was an error writing this file');
      }
      else {
          echo "$ret bytes written to file";
      }
  }
  else {
     die('no post data to process');
  }
  
  ?&gt;
  </code></pre>
  
  <p>Don't think I need to include this but I found a really cool looking login form and changed the names of course:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html &gt;
    &lt;head&gt;
      &lt;meta charset="UTF-8"&gt;
      &lt;title&gt;Material Login Form&lt;/title&gt;
  
  
      &lt;link rel="stylesheet" href="css/reset.css"&gt;
  
      &lt;link rel='stylesheet prefetch' href='http://fonts.googleapis.com/css?family=Roboto:400,100,300,500,700,900|RobotoDraft:400,100,300,500,700,900'&gt;
  &lt;link rel='stylesheet prefetch' href='http://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css'&gt;
  
          &lt;link rel="stylesheet" href="css/style.css"&gt;
    &lt;/head&gt;
  
    &lt;body&gt;
  
  
  &lt;!-- Mixins--&gt;
  &lt;!-- Pen Title--&gt;
  &lt;div class="pen-title"&gt;
    &lt;h1&gt;Material Login Form&lt;/h1&gt;&lt;/div&gt;
  &lt;div class="rerun"&gt;&lt;a href=""&gt;Rerun Pen&lt;/a&gt;&lt;/div&gt;
  &lt;div class="container"&gt;
    &lt;div class="card"&gt;&lt;/div&gt;
    &lt;div class="card"&gt;
      &lt;h1 class="title"&gt;Login&lt;/h1&gt;
      &lt;form&gt;
        &lt;div class="input-container"&gt;
          &lt;input name="email" type="text" id="Username" required="required"/&gt;
          &lt;label for="Username"&gt;Email&lt;/label&gt;
          &lt;div class="bar"&gt;&lt;/div&gt;
        &lt;/div&gt;
        &lt;div class="input-container"&gt;
          &lt;input name="password" type="password" id="Password" required="required"/&gt;
          &lt;label for="Password"&gt;Password&lt;/label&gt;
          &lt;div class="bar"&gt;&lt;/div&gt;
        &lt;/div&gt;
        &lt;div class="button-container"&gt;
          &lt;button&gt;&lt;span&gt;Go&lt;/span&gt;&lt;/button&gt;
        &lt;/div&gt;
        &lt;div class="footer"&gt;&lt;a href="#"&gt;Forgot your password?&lt;/a&gt;&lt;/div&gt;
      &lt;/form&gt;
    &lt;/div&gt;
    &lt;div class="card alt"&gt;
      &lt;div class="toggle"&gt;&lt;/div&gt;
      &lt;h1 class="title"&gt;Register
        &lt;div class="close"&gt;&lt;/div&gt;
      &lt;/h1&gt;
      &lt;form&gt;
        &lt;div class="input-container"&gt;
          &lt;input type="text" id="Username" required="required"/&gt;
          &lt;label for="Username"&gt;Email&lt;/label&gt;
          &lt;div class="bar"&gt;&lt;/div&gt;
        &lt;/div&gt;
        &lt;div class="input-container"&gt;
          &lt;input type="password" id="Password" required="required"/&gt;
          &lt;label for="Password"&gt;Password&lt;/label&gt;
          &lt;div class="bar"&gt;&lt;/div&gt;
        &lt;/div&gt;
        &lt;div class="input-container"&gt;
          &lt;input type="password" id="Repeat Password" required="required"/&gt;
          &lt;label for="Repeat Password"&gt;Repeat Password&lt;/label&gt;
          &lt;div class="bar"&gt;&lt;/div&gt;
        &lt;/div&gt;
        &lt;div class="button-container"&gt;
          &lt;button&gt;&lt;span&gt;Next&lt;/span&gt;&lt;/button&gt;
        &lt;/div&gt;
      &lt;/form&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;!-- Portfolio--&gt;&lt;a id="portfolio" href="http://andytran.me/" title="View my portfolio!"&gt;&lt;i class="fa fa-link"&gt;&lt;/i&gt;&lt;/a&gt;
  &lt;!-- CodePen--&gt;&lt;a id="codepen" href="http://codepen.io/andytran/" title="Follow me!"&gt;&lt;i class="fa fa-codepen"&gt;&lt;/i&gt;&lt;/a&gt;
      &lt;script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'&gt;&lt;/script&gt;
  
          &lt;script src="js/index.js"&gt;&lt;/script&gt;
  
  
  
  
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I'm at a loss here, I have no clue what to fix!</p>