Database Dropdown

Home Forums Quform WordPress Database Dropdown

This topic is: not resolved
  • This topic has 5 replies, 2 voices, and was last updated 8 years ago by Ally.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #21663
    webs911
    Participant

    Trying to populate a dropdown with values from a database table. I’ve read through previous posts and followed your instructions diligently, but still having problems getting it to work. Please help:

    //function mytheme_dynamic_dropdown_values($form)
    //{
    //$options = array();
    //$dbc = mysql_connect(‘localhost’, ‘root’, ‘password’, ‘user’);
    //$query = “SELECT * FROM e2015730_nigp”;
    //$result = mysql_query($dbc, $query);
    //$data_array = array();
    //while ($row = mysql_fetch_assoc($result)) {
    //$options[] = array(‘label’ => $row[‘NIGP Code’], ‘value’ => $row[‘NIGP Code’]);
    //}

    //$dropdown = $form->getElement(‘iphorm_6_47’);
    //if ($dropdown instanceof iPhorm_Element_Select) {
    //$dropdown->setOptions($options);
    //}
    //}
    //add_action(‘iphorm_pre_display_6’, ‘mytheme_dynamic_dropdown_values’);

    • This topic was modified 8 years ago by webs911.
    #21669
    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.

    #21673
    webs911
    Participant

    Thanks for your response, Ally. Was I also supposed to add a shortcode to the form field to connect to my php code? Didn’t see any reference to that on the knowledge base here. I’m using a “single line text” field for this. Thanks.

    • This reply was modified 8 years ago by webs911.
    Attachments:
    You must be logged in to view attached files.
    #21688
    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.

    #21754
    webs911
    Participant

    Perhaps my question wasn’t clear enough. I’ve used the code to create the plugin to connect to my database. Now, how do I display my data (from the database) in the dropdown field in form builder?

    #21779
    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. © 2025 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy