I know I am doing this wrong, but I am trying to set a default state based on a value in a table. Here's what I have in my functions.php file:
add_filter('gform_field_value_fhstate', 'fhpopulate_state');
function fhpopulate_state($value){
global $wpdb;
global $current_user;
get_currentuserinfo();
$myresult = $wpdb->get_var('select state from fh_contact where user_login="'.$current_user->user_login.'"');
return $myresult;
}
All of my other fields that are text fields, it works great. But how would I do this for the state select field?
Thanks!