Dropdown Values from SQL query

Home Forums Quform WordPress Dropdown Values from SQL query

This topic is: not resolved
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #18390
    mtupuschies
    Participant

    Hi,

    currently I have a dropdown which gets all the users from the WP database:

    function my_dropdown_users(iPhorm $form)
    {
        $dropdown = $form->getElement('iphorm_27_3');
    
        if ( ! $dropdown instanceof iPhorm_Element_Select) {
            return;
        }
    
        $users = array();
    
        foreach (get_users() as $user) {
            $users[] = array(
                'label' => $user->display_name,
                'value' => $user->display_name
            );
        }
    
        $dropdown->setOptions($users);
    }
    
    add_filter('iphorm_pre_display_27', 'my_dropdown_users');

    I was wondering if it was possible to (and how to) change the array to pull info from any given table using a SELECT statement.

    Thanks in avance!
    Marcel

    #18426
    Allan
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #18448
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy