<?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: Dynamically Populating Field with Variable through a PHP Embed</title>
		<link>https://legacy.forums.gravityhelp.com/topic/dynamically-populating-field-with-variable-through-a-php-embed</link>
		<description>Gravity Support Forums Topic: Dynamically Populating Field with Variable through a PHP Embed</description>
		<language>en-US</language>
		<pubDate>Tue, 07 Apr 2026 21:47:41 +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/dynamically-populating-field-with-variable-through-a-php-embed" rel="self" type="application/rss+xml" />

		<item>
			<title>David Smith on "Dynamically Populating Field with Variable through a PHP Embed"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/dynamically-populating-field-with-variable-through-a-php-embed#post-32449</link>
			<pubDate>Sat, 13 Aug 2011 08:13:07 +0000</pubDate>
			<dc:creator>David Smith</dc:creator>
			<guid isPermaLink="false">32449@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi Steve,&#60;/p&#62;
&#60;p&#62;Assuming that your &#34;echo $name;&#34; is working and the $name variable is correctly being retrieved from the outside database, declaring the $name as a global inside the &#60;strong&#62;jobname()&#60;/strong&#62; function should allow you to access that variable. Currently, the &#60;strong&#62;$name&#60;/strong&#62; variable is not within the scope of the jobname() function.&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;[php]
function jobname($value){
    global $name;
    return $name;
}&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>stevebenjamins on "Dynamically Populating Field with Variable through a PHP Embed"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/dynamically-populating-field-with-variable-through-a-php-embed#post-32340</link>
			<pubDate>Thu, 11 Aug 2011 19:18:49 +0000</pubDate>
			<dc:creator>stevebenjamins</dc:creator>
			<guid isPermaLink="false">32340@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Ideally yes, but $name in this case is drawing from an outside database:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;$name = $this-&#38;gt;get_field(&#38;#39;name&#38;#39;);&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;And I can't use the database object from within the function :)
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Chris Hajer on "Dynamically Populating Field with Variable through a PHP Embed"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/dynamically-populating-field-with-variable-through-a-php-embed#post-32321</link>
			<pubDate>Thu, 11 Aug 2011 16:59:35 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">32321@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Shouldn't $name be inside your function?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>stevebenjamins on "Dynamically Populating Field with Variable through a PHP Embed"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/dynamically-populating-field-with-variable-through-a-php-embed#post-32300</link>
			<pubDate>Thu, 11 Aug 2011 15:10:35 +0000</pubDate>
			<dc:creator>stevebenjamins</dc:creator>
			<guid isPermaLink="false">32300@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi, I just upgraded my license to developer and am finding more and more great uses for Gravity Forms every day. Thanks for doing great work :)&#60;/p&#62;
&#60;p&#62;I'm having some difficulty using a PHP variable to dynamically populate a field. When I use this code:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;add_filter(&#38;quot;gform_field_value_jobname&#38;quot;, &#38;quot;jobname&#38;quot;);
	function jobname($value){
         return &#38;quot;test&#38;quot;;
	}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;It dynamically populates the field perfectly. But when I try to dynamically populate with a variable:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;$name = $this-&#38;gt;get_field(&#38;#39;name&#38;#39;);
echo $name;
	add_filter(&#38;quot;gform_field_value_jobname&#38;quot;, &#38;quot;jobname&#38;quot;);
	function jobname($value){
	return $name;
	}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;It doesn't work. I know $value is set, I just can't seem to figure out how to get $value dynamically populated!&#60;/p&#62;
&#60;p&#62;Any thoughts?
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
