title: How to keep line with text when create file txt - PHP
body: <p>I have code</p>
  
  <pre><code>$file = fopen("file.txt",'w+');
  if(isset($_POST['email']))
  $string = $_POST['email'];;
  fwrite($file, $string);
  </code></pre>
  
  <p>$string have value:</p>
  
  <pre><code>I HAVE
  NEW LINE
  </code></pre>
  
  <p>But after i run my code, i had open file.txt. This see:</p>
  
  <pre><code>I HAVE NEW LINE
  </code></pre>
  
  <p>I want keep line same when i input with form.
  My form</p>
  
  <pre><code>echo '&lt;form method="POST" id="formmail" role="form"&gt;' .
      "\n" . '&lt;div class="form-group"&gt;' .
          "\n" . '&lt;input type="email" id="from" class="form-control" name="from" placeholder="From Email"&gt;' .
      "\n" . '&lt;/div&gt;' .
      "\n" . '&lt;div class="form-group"&gt;' .
          "\n" . '&lt;input type="email" id="to" class="form-control" name="to" placeholder="To Email"&gt;' .
      "\n" . '&lt;/div&gt;' .
      "\n" . '&lt;div class="form-group"&gt;' .
          "\n" . '&lt;input type="text" id="title" class="form-control" name="title" placeholder="Title Email"&gt;' .
      "\n" . '&lt;/div&gt;' .
      "\n" . '&lt;div class="form-group"&gt;' .
          "\n" . '&lt;textarea cols="80" rows="10" id="list" placeholder="Enter List Email" class="form-control"/&gt;&lt;/textarea&gt;' .
      "\n" . '&lt;/div&gt;' .
      "\n" . '&lt;div class="form-group"&gt;' .
          "\n" . '&lt;textarea cols="80" rows="10" id="content" placeholder="Enter content Email" class="form-control"/&gt;&lt;/textarea&gt;' .
      "\n" . '&lt;/div&gt;' .
      "\n" . '&lt;button id="OK" class="btn btn-danger"&gt;Sent Mail&lt;/button&gt;' .
  "\n" . '&lt;/form&gt;';
  </code></pre>
  
  <p>Javascript</p>
  
  <pre><code>&lt;script&gt;
      $(document).ready(function(e) {
          $("#OK").click(function(e) {
              var email = $('#list').val();
              $.ajax({
                  type: 'POST',
                  url: 'mail.php',
                  data: 'email='+email,
                  success: function(answer){
                      $('.kq').html(answer);
                  }
              });
              return false;
          });
      });
  &lt;/script&gt;
  </code></pre>
  
  <p><a href="http://i.imgur.com/sjy0BEZ.png" rel="nofollow">http://i.imgur.com/sjy0BEZ.png</a>
  <a href="http://i.imgur.com/cxayF5Y.png" rel="nofollow">http://i.imgur.com/cxayF5Y.png</a></p>