Jump to content

Predictive Search Location on PHP


arpittailang

Recommended Posts

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 :

 

div class="search_row clearfix">
            <label> <?php _e(SEARCH_LOCATION_TEXT); ?> : </label>   
                <select name="srch_location" id="srch_location" onchange="" class="fl select">
                 <option value=""><?php _e(SEARCH_ALL_LOCATION_TEXT); ?> </option>
                  <?php echo get_location_dl($_REQUEST['srch_location']);?>
                <?php //echo get_category_dropdown_options(get_cat_id_from_name(get_option('ptthemes_locationcategory')),$_REQUEST['srch_location']);?>
               </select>

I think "srch_location" is the location where all these location saved. How can i show these to predictive search. Please answer in steps so i can understand because i dont know php very well.

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 :

onchange="<?php echo get_location_dl($_REQUEST['srch_location']);?>"

but its not working but I am 100% sure and tested that this code is working well when i code dropdown for location textbox. I just need to work as well for predictive search.

 

Thank you very much.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.