Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

highlight the word searched for?

Status
Not open for further replies.

hisham

IS-IT--Management
Nov 6, 2000
194
How to highlight the word searched for? For example, if I searched for "forum" and the following text was returned as a result from the database then I would like forum to be highlighted in yellow:
"Click the forum name to add it to your list."
Thanks in advance
 
should behave correctly , ...

$string="Click the forum name to add it to your list.";
$searchword="forum";

$result=str_replace($searchword,&quot;<font color=yellow>$searcword</font>&quot;,$string);

echo $result;


______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top