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 Quote Link to comment 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. Quote Link to comment 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? Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
Bendude14 Posted July 3, 2008 Author Share Posted July 3, 2008 ok thanks for the advice Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.