PHP nl2br posting duplicate <br/>'s?
<p>I'm using the following code to post the content of a text box to an HTML file. When the info is submitted, I want there to be <code>&lt;br/&gt;</code> inserted where line-breaks are. I thought using this code would fix the problem:</p>

<p><code>$content = nl2br($_POST['content']);</code></p>

<p>But it seems to produce the following if there is already a <code>&lt;br /&gt;</code> in place:</p>

<blockquote>
  <p>Lorum ipsum.<code>&lt;br /&gt;&lt;br /&gt;</code></p>
</blockquote>

<p>How do I remedy this?</p>

<p>The post code:</p>

<pre><code>&lt;?php
$fn = "people.html";
if (isset($_POST['content']))
{
    $content = stripslashes('content');
    $content = nl2br($_POST['content']);
    $fp = fopen($fn,"w") or die ("Error opening file in write mode!");
    fputs($fp,$content);
    fclose($fp) or die ("Error closing file!");
}
?&gt;
</code></pre>

<p>How it's being submitted:</p>

<pre><code>&lt;form action="&lt;?php echo $_SERVER["PHP_SELF"] ?&gt;" method="post"&gt;
    &lt;textarea rows="25" cols="40" name="content"&gt;&lt;?php readfile($fn); ?&gt;&lt;/textarea&gt;
    &lt;input type="submit" value="Sauver"&gt; 
&lt;/form&gt;
</code></pre>
