Forum Replies Created

Viewing 1 replies (of 1 total)
  • Thread Starter GreatDayDan

    (@greatdaydan)

    I went through the documentation again. Did not see how to load my data into a dropdown.

    I have this function, which should

    <?php

    function gddGetNames($form){
       if($form["id"] != 225)
           return $form;	
      global $wpdb;
      global $result;
      global $value;
      global $results;
        //Adding initial blank value.
        $items[] = array("text" => "Select the Family name", "value" => "");
      
      $results = $wpdb->get_results ( "SELECT name FROM $wpdb->moFamilyName" , object);
    
      if($results)
       {
        foreach($form["fields"] as &$field)
          {  $field["choices"] = $items;
          }
        return $form;
       }
    add_action('GetNames', 'gddGetNames($form)');
    add_action("GetEvents", 'gddGetEvents'); 
    }

    ?>

    or is this the way to load the dropdown:

    <?php
    function gddGetNames($form){
       if($form["id"] != 225)
           return $form;	
      global $wpdb;
      global $result;
      global $value;
      global $results;
      
    
      $results = $wpdb->get_results ( "SELECT name FROM $wpdb->moFamilyName");
    
      if($results)
       {
        $form.$field["choices"] = $results;
       }
        return $form;
       }
        
         
    
    add_action('GetNames', 'gddGetNames($form)');
    add_action("GetEvents", 'gddGetEvents'); 
    
    	
    }

    ?>

    Thanks…Dan’l

Viewing 1 replies (of 1 total)