how can i replace content of text area by PHP script in below mentioned code
<p>I have taken 2 text boxes and 1 text area
User will be to search the content through search box
and provides by which word it should be replaced.</p>

<p>Scenerio 1 :</p>

<p>I want to replace "Good" with word "bad"<br>
But this code does not replace the text area content.
It rather appends with the new replaced string</p>

<p>what's the solution ??</p>

<pre><code>&lt;body&gt;

&lt;form id="form1" name="form1" method="post" action=""&gt;

&lt;p&gt;
&lt;label for="search"&gt;Search :&lt;/label&gt;
&lt;input type="text" name="search" id="search" /&gt;
&lt;/p&gt;

&lt;p&gt;
&lt;label for="replace"&gt;Replace&lt;/label&gt;
&lt;input type="text" name="replace" id="replace" /&gt;
&lt;/p&gt;

&lt;p&gt;&lt;Br /&gt;
&lt;input type="submit" name="submit" id="submit" value="Submit" /&gt;
&lt;label for="textarea"&gt;&lt;/label&gt;
&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;
&lt;textarea name="textarea" id="textarea" cols="45" rows="5"  &gt;
"Good morning how are you today are you feeling Good.";
&lt;?php

if(isset($_POST["submit"]))
{
     $search = $_POST["search"];
 $replace = $_POST["replace"];
 $textarea = $_POST["textarea"];

 $newtext = str_replace($search,$replace,$textarea);
     echo $newtext;

}

?&gt;
   &lt;/textarea&gt;
  &lt;/p&gt;
&lt;/form&gt;

&lt;/body&gt;
&lt;/html&gt;
</code></pre>
