با سلام...این کد ایرادایی داره..لطفا ایراداشو بگید تا بدونم مشکل کارم کجا بوده..ممنون

PHP:
<?php
if (isset($_POST['user_input']) && isset($_POST['user_search']) && isset($_POST['user_replace']))
{
$user_input = $_POST['user_input'];
$find = $_POST['user_search'];
$replace = $_POST['user_replace'];
//echo str_replace($replace , $find , $user_input);
$offset = 0;
$find_length = strlen($find);
if (!empty($_POST['user_input']) && !empty($_POST['user_search']) && !empty($_POST['user_replace']))
{
while ($string_position=strpos($user_input,$find,$offset))
{
//echo $find.' found at '.$string_position.'<br>';
$offset = $string_position + $find_length;
$text = substr_replace($user_input,$replace,$string_position,$find_length);
}
echo $text;
}
}
?>
<form action="42.Creating a Find and Replace Application.php" method="post">
<textarea name="user_input" rows="6" cols="30"><?php echo $user_input ?></textarea>
<br /><br />
Search<br>
<input type="text" name="user_search" /><br />
<br />
Replace<br>
<input type="text" name="user_replace" /><br />
<br />
<input type="submit" value="Submit" />
</form>