Bendude14 Posted July 1, 2008 Share Posted July 1, 2008 I would like to create a search box exactly like what firefox has built in so people can click search on my page then type whatever they want to search for. And the page will automatically move to the the first instance of this word. Could any one give me some suggestions on which would be the best way to go about this.. Thanks Link to comment https://forums.phpfreaks.com/topic/112721-solved-search-page/ Share on other sites More sharing options...
lemmin Posted July 1, 2008 Share Posted July 1, 2008 You can probably use preg_replace to add an anchor to what you are searching for: preg_replace("[($searchterm)]", "<a name=\"found\" style=\"background-color:yellow\">$1</a>", $searchsubject); You can even highlight it if you want. Link to comment https://forums.phpfreaks.com/topic/112721-solved-search-page/#findComment-579205 Share on other sites More sharing options...
Bendude14 Posted July 2, 2008 Author Share Posted July 2, 2008 That means assigning the whole page to the search variable though would it not? Link to comment https://forums.phpfreaks.com/topic/112721-solved-search-page/#findComment-579703 Share on other sites More sharing options...
lemmin Posted July 2, 2008 Share Posted July 2, 2008 Yep. I don't know what method you use to search your pages, but if find the location of the search terms you can use offsets with substr_replace to do something similar. Link to comment https://forums.phpfreaks.com/topic/112721-solved-search-page/#findComment-580077 Share on other sites More sharing options...
Bendude14 Posted July 3, 2008 Author Share Posted July 3, 2008 ok thanks for the advice Link to comment https://forums.phpfreaks.com/topic/112721-solved-search-page/#findComment-580511 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.