<?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: Best method for passing variables</title>
		<link>https://legacy.forums.gravityhelp.com/topic/best-method-for-passing-variables</link>
		<description>Gravity Support Forums Topic: Best method for passing variables</description>
		<language>en-US</language>
		<pubDate>Mon, 20 Apr 2026 01:07:00 +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/best-method-for-passing-variables" rel="self" type="application/rss+xml" />

		<item>
			<title>Chris Hajer on "Best method for passing variables"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/best-method-for-passing-variables#post-152725</link>
			<pubDate>Sat, 23 Feb 2013 00:13:11 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">152725@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Ah yes, you called a non-existent function in the filter. This is more correct:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;[php]
add_filter(&#38;quot;gform_field_value_discount_code&#38;quot;, &#38;quot;populate_have_code&#38;quot;);
function populate_have_code($value){
    return $_SESSION[&#38;#39;discount_code_s&#38;#39;];
}&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>rladouceur on "Best method for passing variables"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/best-method-for-passing-variables#post-150954</link>
			<pubDate>Wed, 20 Feb 2013 13:02:06 +0000</pubDate>
			<dc:creator>rladouceur</dc:creator>
			<guid isPermaLink="false">150954@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Never mind ... typo on line 3. You can close this.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>rladouceur on "Best method for passing variables"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/best-method-for-passing-variables#post-150941</link>
			<pubDate>Wed, 20 Feb 2013 12:35:49 +0000</pubDate>
			<dc:creator>rladouceur</dc:creator>
			<guid isPermaLink="false">150941@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Perhaps this question will be within the limits of support?&#60;/p&#62;
&#60;p&#62;I've figured out how to implement session variables in my Wordpress installation and pass 2 bits of data embedded in a query string to the variables. I've set two fields in my form so they may be populated dynamically. &#60;/p&#62;
&#60;p&#62;Now I just need the syntax that will allow the form to access those session variables when the form is called. I'm using:&#60;/p&#62;
&#60;p&#62;add_filter(&#34;gform_field_value_discount_code&#34;, &#34;populate_discount_code&#34;);&#60;br /&#62;
function populate_have_code($value){&#60;br /&#62;
   return $_SESSION['discount_code_s'];&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;But this is throwing an error.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>David Peralty on "Best method for passing variables"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/best-method-for-passing-variables#post-150195</link>
			<pubDate>Tue, 19 Feb 2013 11:24:49 +0000</pubDate>
			<dc:creator>David Peralty</dc:creator>
			<guid isPermaLink="false">150195@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Yeah, it is definitely possible, and you should be able to do it without too much issue. Just search the stuff out on Google, and I am sure you'll find a tutorial that helps you with what you need.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>rladouceur on "Best method for passing variables"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/best-method-for-passing-variables#post-150189</link>
			<pubDate>Tue, 19 Feb 2013 11:19:47 +0000</pubDate>
			<dc:creator>rladouceur</dc:creator>
			<guid isPermaLink="false">150189@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;David. I completely understand the necessary limits of support through this forum. Your answer at least gives me the confidence to pursue this inquiry via search. Thanks!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>David Peralty on "Best method for passing variables"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/best-method-for-passing-variables#post-150187</link>
			<pubDate>Tue, 19 Feb 2013 11:17:52 +0000</pubDate>
			<dc:creator>David Peralty</dc:creator>
			<guid isPermaLink="false">150187@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;You would want to use a cookie or session variables, and it would go above and beyond our support to do walk throughs on these topics. If you search for PHP writing cookie or PHP sessions on Google, you'll find a great deal of tutorials relating to this.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>rladouceur on "Best method for passing variables"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/best-method-for-passing-variables#post-150158</link>
			<pubDate>Tue, 19 Feb 2013 10:34:49 +0000</pubDate>
			<dc:creator>rladouceur</dc:creator>
			<guid isPermaLink="false">150158@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Forgive this non-coder's question. I can cut and paste into functions.php with the best of them, but understand little of the mechanics. &#60;/p&#62;
&#60;p&#62;I've created an order form that accepts a pre-defined discount code. If the code is correct, a higher price field is hidden and a lower price field becomes visible. I have figured out how to pass 2 variables to the form using a query string at the end of a URL. I intend to publish the URL + query string to select email list subscribers. Everything works, but of course if the recipient navigates to any other page of the website, the variables are lost. And when they navigate back to the form, the form conditions revert to a standard state, and the higher price.&#60;/p&#62;
&#60;p&#62;Is there a relatively easy way to maintain the passed parameters for a session? Ideally, I'd like to allow users who navigate to the site using the URL + query string to move around the site and return to the form with the discount code still intact. A cookie? And if so, I'll need a step-by-step.
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
