Hi,
I was making a search box and was trying to highlight the words that the users will enter in the search box,for example if the user enter "kids" in the searchbox it should highlight the "kids" word in the result............. is anyone have an idea how to do that
micahgeorge 0 Newbie Poster
Recommended Answers
Jump to Post— nonshatter 26You will need some sort of regular expression to find the matching word.
E.g:$i=0; while (there are results) { if(preg_match("/the search term/i", $results[$i], $yellow)) { echo "<span id = "yellow">" $yellow[$i] . $results[$i] ."</span><br>"; } }Not exactly... but you can follow the logic x
Jump to Post— Member #720405Hi micahgeorge,
I've done this before in a previous project. However I didn't use PHP, rather JS. Once the user entered the search term, the term was submitted to a PHP script that displayed the search results. Each of the search result URLs were appended with ?query=<search-term>. I then …
All 5 Replies
nonshatter 26 Posting Whiz
Member #720405
Member #720405
micahgeorge 0 Newbie Poster
muralibobby2015 17 Posting Pro
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.