![]() |
Predictive Search using PHP on Wordpress Theme
Hello, I am customizing a wordpress theme. It contains a Location Search that shows locations as drop down menu. But i want to show predictive search such as when user types "NE" it shows "New York, united States". It is also called autocomplete. I want a solution for a it from beginning as i am completely newbie.
The Theme has admin panel where an option allow to add locations, and these location are saved in database. I just need these locations to show on predictive search. Here is the code that calls the location databsae : PHP Code:
Also it would be good if yoou include the easy jQuery or AJAX Script that does the job and a guide how to implement in the code. Update: How to call the location where country list is saved using php? for example i am using this code to get the location to be appear on the predictive search : PHP Code:
Thank you very much. |
For predictive autocomplete, you need to be looking at jQuery autocomplete... If as you are saying a complete newbie to php, you may be biting off more than you can chew for a first hack. However, do not let this put you off, rather than do the code for you, the best way to learn is to try, then post questions when you get stuck, there are 100's of tutorials out there..
A Good placed to start is : HERE |
Thank you very much for your reply.
I am stuck, its true and i posted here after searching on google a lot. I am following this tutorial : http://www.script-tutorials.com/auto...mysql-and-xml/ All details i already posted and eager if any one helps. In the tutorial, the locations are taken from database, whereas i want to show the locations using "srch_location" (PHP Code Required) |
Thank you very much for your reply.
I am stuck, its true and i posted here after searching on google a lot. I am following this tutorial : http://www.script-tutorials.com/auto...mysql-and-xml/ All details i already posted and eager if any one helps. In the tutorial, the locations are taken from database, whereas i want to show the locations using "srch_location" (PHP Code Required) |
According to this source code the function get_location_dl outputs HTML. The parameter ($_REQUEST['srch_location']) is just "remembered" selected option. As you can see srch_location is the name of the "select" element and element of the array $_REQUEST.
Have you tried to check the source of the page with this code? If you're using this functions you could easily use jQuery autocomplete with code like this: HTML Code:
<input name="srch_location" id="srch_location" value="<?php echo htmlspecialchars($_REQUEST['srch_location']); ?>"/> |
| All times are GMT. The time now is 07:05 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0