<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Gravity Support Forums Topic: DB lookups for selects and radio button options</title>
		<link>https://legacy.forums.gravityhelp.com/topic/db-lookups-for-selects-and-radio-button-options</link>
		<description>Gravity Support Forums Topic: DB lookups for selects and radio button options</description>
		<language>en-US</language>
		<pubDate>Sun, 19 Apr 2026 22:21:12 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.1</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>https://legacy.forums.gravityhelp.com/search.php</link>
		</textInput>
		<atom:link href="https://legacy.forums.gravityhelp.com/rss/topic/db-lookups-for-selects-and-radio-button-options" rel="self" type="application/rss+xml" />

		<item>
			<title>electricscribe on "DB lookups for selects and radio button options"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/db-lookups-for-selects-and-radio-button-options#post-203515</link>
			<pubDate>Wed, 10 Apr 2013 04:43:38 +0000</pubDate>
			<dc:creator>electricscribe</dc:creator>
			<guid isPermaLink="false">203515@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;OK, I have slugged through a lot of stuff to get GF working for me. And I've been able to so far. What I, and seemingly others really need is a working example (not one line code snippets like in the GF dox) of how to do this. I can hack some code here and there, but I've never written code to interface with a database and populate the arrays. I have written a piss poor outline of what I am trying to do here. Can anyone flesh this out for me and the rest of the GF community? And explain where it goes and how to use it REAL WORLD?&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;add_filter(&#38;#39;gform_pre_render_51&#38;#39;, &#38;#39;populate_familyIDs&#38;#39;);

define function populate_familyIDs {

foreach($form[&#38;#39;fields&#38;#39;] as &#38;amp;$field){ 

if($field[&#38;#39;type&#38;#39;] != &#38;#39;radio&#38;#39; &#124;&#124; strpos($field[&#38;#39;FamilyIDclass&#38;#39;], &#38;#39;populate_familyIDs&#38;#39;) === false)
	    continue;
if($field[&#38;#39;type&#38;#39;] != &#38;#39;select&#38;#39; &#124;&#124; strpos($field[&#38;#39;FamilyIDclass&#38;#39;], &#38;#39;populate_familyIDs&#38;#39;) === false)
	    continue;
}

global $wpdb;
$arrayforradiochoices = $wpdb-&#38;gt;get_results(&#38;quot;SELECT ALL(field_number=29) as IDs FROM wp_rg_lead_detail WHERE form_id=4 AND field_number=28 );
    return $arrayforradiochoices;
    return $arrayforselectchoices;

} // end populate_familyIDs

And then some code to populate the radio or select choices.&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;I hope this gives an idea of what we are trying to do.&#60;br /&#62;
I know there are many on here that will at the very least, give you our sincere gratitude.&#60;br /&#62;
If you require more, let us know.&#60;/p&#62;
&#60;p&#62;I am sure many have done this. &#60;/p&#62;
&#60;p&#62;Thank You for considering helping us out.
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
