title: line breaks in a textarea
body: <p>I know when saving a textarea you can use the nl2br() or str_replace to change the /n to br tags etc. However what im not sure about how to insert line breaks into a textarea. I cant seem to find much about putting the data back into a textarea with those line breaks.</p>
  
  <p>For example I have a form where users can update fields. So the user may enter:</p>
  
  <pre><code>foo
  bar
  baz
  </code></pre>
  
  <p>When that is saved to the database it would be saved as:</p>
  
  <pre><code>foo&lt;br /&gt;bar&lt;br /&gt;baz&lt;br /&gt;
  </code></pre>
  
  <p>Now when that user goes back to that form after a page refresh all the fields are automatically populated with their previous data by taking the data from the database.</p>
  
  <p>However the textarea shows the br tags as text instead of adding in the line breaks. i also tried changing the br tags to /n hoping the textarea would interpret these as line breaks but no joy. As well as this I also tried escaping etc.</p>
  
  <p>So my questions are can this be done? Or more importantly can it be done using HTML/PHP (im using smarty). If that isnt possible can it be done using javascript?</p>
  
  <p>Examples would be appreciated.</p>
  
  <p>thanks for reading</p>