title: How to keep linebreaks in html textarea POST data
body: <p>I am trying to have lyrics to a song submitted into a text area.  So, this needs to keep the line-breaks when I output.  I am aware of the fact that browsers standard should use <code>\r\n</code> as the line-break, and PHP's nl2br() function can convert the <code>\r\n</code> into <code>&lt;br&gt;</code>tags.  </p>
  
  <p>I am also aware of the fact that textarea inputs require wrap="hard" in order to pass the line-breaks, otherwise the default of wrap="soft" will ignore, and that cols="" must be specified when using wrap="hard".  I have attempted to accomplish this with the html below:</p>
  
  <pre><code>&lt;textarea wrap="hard" name="reading_text" cols="450" rows="6" maxlength="5000"&gt;&lt;/textarea&gt;
  </code></pre>
  
  <p>However, the POST array does not show any line breaks.  I enter this into the textarea: </p>
  
  <blockquote>
    <p>Line one of the lyrics</p>
    
    <p>That were entered into the textarea</p>
    
    <p>Alas to my dismay </p>
    
    <p>Red eyes and fire and signs </p>
    
    <p>Because the line-breaks are not in the POST data</p>
    
    <p>I want to make a ray of sunshine and never leave home</p>
  </blockquote>
  
  <p>I get this in the POST array: </p>
  
  <pre><code>array(5) { ["reading_text"]=&gt; string(216) "Line one of the lyrics That were entered into the textarea Alas to my dismay Red eyes and fire and signs Because the line-breaks are not in the POST data" ["add_reading"]=&gt; string(3) "Add" }
  </code></pre>
  
  <p>To make matters more confusing for me I tried to look at W3 Schools demo (<a href="https://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_textarea_wrap" rel="nofollow noreferrer">https://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_textarea_wrap</a>).  However, I cannot seem to even make that example work.  When I enter many line breaks into the textarea, the text comes out with no <code>\r\n</code>.</p>
  
  <p>What am I missing here?</p>