Populate dropdown

Home Forums Quform WordPress Populate dropdown

This topic is: not resolved

This topic contains 5 replies, has 2 voices, and was last updated by  Ally 5 hours, 29 minutes ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #29608

    Icemanmx
    Participant

    Hello
    I want to populate dropdown from standalone database, i have this code:

    <?php

    /*
    * Plugin Name: Population of code
    * Description: Special code quform2.
    * Version: 2.0
    */

    // Start Encuesta Post Evento with codes.txt file.

    //quform_error_log($result);

    function mytheme_dynamic_dropdown_values($form)
    {
    $db = new wpdb('xxx', 'xxx', 'xxx', 'localhost');
    $results = $db->get_results("SELECT * FROM code", ARRAY_A);

    $options = array();
    foreach($results as $row) {
    $options[] = array('label' => $row['CODE'], 'value' => $row['CODE']);
    }

    $dropdown = $form->getElement('quform_3_3');
    if ($dropdown instanceof quform_Element_Select) {
    $dropdown->setOptions($options);
    }
    }
    add_action('quform_pre_display_3', 'mytheme_dynamic_dropdown_values');

    ?>

    But it dows not show me nothing, i also changed fron iphorm to quform
    Any help how to do this in Quform2?

    Best Regards
    Icemanmx

    #29623

    Icemanmx
    Participant

    Anyone can help?

    #29629

    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.

    #29631

    Icemanmx
    Participant

    Hello
    I put all in one zip file, screens and debug logs, server log and wp debug log.
    I need to say i have php 7.3 installed…

    Best Regards
    Icemanmx

    Attachments:
    You must be logged in to view attached files.
    #29652

    Icemanmx
    Participant

    Hello
    Someone took a look yet?

    Icemanmx

    #29657

    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 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.

Be inspired. © 2019 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy