Im want to hightlight the search string that is given by the user, in the result. The problem is that it is getting highlighted but the case of the orignal word from the database is changed by the case of the search string given by the user.
The code is as given below
<form action="searchtest.php3" method="post" name="highlight">
<input type="text" name="search">
<input type="submit" name="submit" value="submit">
<? $a="This is test for search Adnan is a good fellow and so so many others. It takes just one brave man to overthrow the chains and shackles of tyranny.Once upon a time there was a King ,It will be continued later" ;
if($submit=='submit')
{
$element=explode(" ",$search);
for($x=0;$x<sizeof($element);$x++)
{
$y="<font color='red' >$element[$x]</font>";
$b=eregi_replace($element[$x],$y,$a);
}
echo $b;
}
?></form>