最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

functions - Dynamic dropdown from database table

programmeradmin1浏览0评论

I need a little help: I want to create a drop-down populated by mysql database table with two options: Select option 1 (regions) Select option 2 (schools)

Where in option 2 appears populated according to option 1. (ie. tot Schools in region 1) and the selection should be stored in User profile.

I know that we can achieve this with functions.php Something like this:

function loadSchools(){
        global $wpdb;
        return $wpdb->get_results( "SELECT MIN(school_id) AS id, region FROM region GROUP BY region" );
    } 

...

Someone already did something similar?

Thank you

发布评论

评论列表(0)

  1. 暂无评论