<?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: How do you add a PHP variable as a hidden input field?</title>
		<link>https://legacy.forums.gravityhelp.com/topic/how-do-you-add-a-php-variable-as-a-hidden-input-field</link>
		<description>Gravity Support Forums Topic: How do you add a PHP variable as a hidden input field?</description>
		<language>en-US</language>
		<pubDate>Mon, 06 Apr 2026 18:35:01 +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/how-do-you-add-a-php-variable-as-a-hidden-input-field" rel="self" type="application/rss+xml" />

		<item>
			<title>Carl Hancock on "How do you add a PHP variable as a hidden input field?"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/how-do-you-add-a-php-variable-as-a-hidden-input-field#post-22049</link>
			<pubDate>Wed, 30 Mar 2011 11:28:49 +0000</pubDate>
			<dc:creator>Carl Hancock</dc:creator>
			<guid isPermaLink="false">22049@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;You would do this using custom PHP and the gform_field_value filter hook.  Documentation for this hook is below:&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://www.gravityhelp.com/documentation/page/Gform_field_value_$parameter_name&#34; rel=&#34;nofollow&#34;&#62;http://www.gravityhelp.com/documentation/page/Gform_field_value_$parameter_name&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;In order to use this hook you must do the following:&#60;/p&#62;
&#60;p&#62;- Edit your Form&#60;br /&#62;
- Add a hidden field you want to populate and give it a name&#60;br /&#62;
- Edit the hidden field&#60;br /&#62;
- Select the Advanced tab&#60;br /&#62;
- Select the &#34;Allow field to be populated dynamically&#34; checkbox&#60;br /&#62;
- Give the field a parameter name, this parameter name is used to target the field so name it something simple like &#34;email&#34; or something similar.&#60;br /&#62;
- Save your form&#60;/p&#62;
&#60;p&#62;Then you would use the gform_field_value hook by adding custom code in your themes functions.php file to dynamically populate that field.  For example, if you set the parameter to &#34;email&#34; your code would look like this:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;?php
add_filter(&#38;quot;gform_field_value_email&#38;quot;, &#38;quot;populate_email&#38;quot;);
function populate_email($value){
   return &#38;quot;email@value.com&#38;quot;;
}
?&#38;gt;&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>karlbitz on "How do you add a PHP variable as a hidden input field?"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/how-do-you-add-a-php-variable-as-a-hidden-input-field#post-22011</link>
			<pubDate>Tue, 29 Mar 2011 21:20:12 +0000</pubDate>
			<dc:creator>karlbitz</dc:creator>
			<guid isPermaLink="false">22011@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I can't seem to find this anywhere and it seems like it should be pretty simple.&#60;/p&#62;
&#60;p&#62;All I want to do is populate a hidden input with a pre-existing PHP variable.&#60;/p&#62;
&#60;p&#62;For example - let's say I already know the user's email. When they fill out the form, normally I might do something like:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;input type=&#38;quot;hidden&#38;quot; id=&#38;quot;email&#38;quot; value=&#38;quot;&#38;lt;?php echo(&#38;#39;$email&#38;#39;); ?&#38;gt;&#38;quot; /&#38;gt;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;How would I replicate this behavior using a Gravity Form?&#60;/p&#62;
&#60;p&#62;Thanks!
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
