<?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: Grabbing $_POST to simulanteously store in a second database</title>
		<link>https://legacy.forums.gravityhelp.com/topic/grabbing-_post-to-simulanteously-store-in-a-second-database</link>
		<description>Gravity Support Forums Topic: Grabbing $_POST to simulanteously store in a second database</description>
		<language>en-US</language>
		<pubDate>Mon, 20 Apr 2026 01:16:02 +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/grabbing-_post-to-simulanteously-store-in-a-second-database" rel="self" type="application/rss+xml" />

		<item>
			<title>TheWizardGuy on "Grabbing $_POST to simulanteously store in a second database"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/grabbing-_post-to-simulanteously-store-in-a-second-database#post-34372</link>
			<pubDate>Sat, 03 Sep 2011 16:44:16 +0000</pubDate>
			<dc:creator>TheWizardGuy</dc:creator>
			<guid isPermaLink="false">34372@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Chris:&#60;/p&#62;
&#60;p&#62;Thank-you! Thank-you!&#60;/p&#62;
&#60;p&#62;I will try this out and get back to you!&#60;/p&#62;
&#60;p&#62;Lawrence
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Chris Hajer on "Grabbing $_POST to simulanteously store in a second database"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/grabbing-_post-to-simulanteously-store-in-a-second-database#post-34289</link>
			<pubDate>Fri, 02 Sep 2011 18:43:24 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">34289@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Looks like in my example I forgot to single quote the $entry['1'], so it's passed as unquoted to mysql_query, which won't work.   &#60;/p&#62;
&#60;p&#62;Try building the query separately, then pass it to mysql_query:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;[php]
$query = &#38;#39;INSERT INTO gns_registration (fname) VALUES (\&#38;#39;&#38;#39; . $entry[&#38;quot;1&#38;quot;] . &#38;#39;\&#38;#39;)&#38;#39;;
mysql_query($query, $con);&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Sorry about the earlier syntax error.  I will edit that now.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>TheWizardGuy on "Grabbing $_POST to simulanteously store in a second database"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/grabbing-_post-to-simulanteously-store-in-a-second-database#post-34281</link>
			<pubDate>Fri, 02 Sep 2011 17:23:26 +0000</pubDate>
			<dc:creator>TheWizardGuy</dc:creator>
			<guid isPermaLink="false">34281@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I think I'm missing something.&#60;/p&#62;
&#60;p&#62;This line works perfectly and puts a new record into the table:&#60;/p&#62;
&#60;p&#62;&#60;code&#62;mysql_query(&#38;quot;INSERT INTO gns_registration (fname) VALUES (&#38;#39;testvalue&#38;#39;)&#38;quot;, $con);&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;(and I started to cheer and say, &#34;Hey that made my long weekend; I can relax&#34;)&#60;br /&#62;
but this one:&#60;/p&#62;
&#60;p&#62;&#60;code&#62;mysql_query(&#38;quot;INSERT INTO gns_registration (fname) VALUES ($entry[&#38;#39;1&#38;#39;]&#38;quot;, $con);&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;generates an error message:&#60;/p&#62;
&#60;p&#62;&#60;code&#62;Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING&#38;#39;&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;(and that made me sad)&#60;/p&#62;
&#60;p&#62;Have I misunderstood or am I typing something really wrong?&#60;/p&#62;
&#60;p&#62;Lawrence
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Chris Hajer on "Grabbing $_POST to simulanteously store in a second database"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/grabbing-_post-to-simulanteously-store-in-a-second-database#post-31425</link>
			<pubDate>Tue, 02 Aug 2011 11:32:53 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">31425@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Couple things to make this work.&#60;/p&#62;
&#60;p&#62;This line:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;add_action(&#38;quot;gform_post_submission_1&#38;quot;, &#38;quot;post_submission&#38;quot;, 10, 2);&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;You need to change the &#34;post_submission&#34; there to the name of your function.  You're hooking YOUR function to the &#34;gform_post_submission&#34; action.  Since the name of your function is &#60;strong&#62;store_in_db2&#60;/strong&#62; the line above should look like this:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;add_action(&#38;quot;gform_post_submission_1&#38;quot;, &#38;quot;store_in_db2&#38;quot;, 10, 2);&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Otherwise, your function will never run.&#60;/p&#62;
&#60;p&#62;Also in that line: this hook will be run for form #1 only (that's the &#60;strong&#62;_1&#60;/strong&#62; added to the end of the hook name.)  Be sure the ID of your form is 1.  If not, change this number to match your form.  &#60;/p&#62;
&#60;p&#62;Finally, in the same line, you're saying that 2 arguments are accepted (that's what the 2 at the end is.)  So, you should call your function with 2 arguments.  This line:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;function store_in_db2($entry){&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Should look like this:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;function store_in_db2($entry, $form){&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;After that, you will be able to get all the values from your form submission.  You can determine the  field id to use by looking at the source of a rendered page.  For the name field, if you're using a name field, the ID might look like this:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;input type=&#38;#39;text&#38;#39; name=&#38;#39;input_1.3&#38;#39; id=&#38;#39;input_12_1_3&#38;#39; value=&#38;#39;&#38;#39; tabindex=&#38;#39;1&#38;#39; /&#38;gt;
&#38;lt;input type=&#38;#39;text&#38;#39; name=&#38;#39;input_1.6&#38;#39; id=&#38;#39;input_12_1_6&#38;#39; value=&#38;#39;&#38;#39; tabindex=&#38;#39;2&#38;#39; /&#38;gt;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;In that case, the values you want are 1.3 and 1.6. Maybe it's not clear from this example that input_12_1_3 becomes 1.3, but if you dump the $entry array, you will see this:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;[1.3] =&#38;gt; Chris2
   [1.6] =&#38;gt; Hajer2
   [2.1] =&#38;gt; 1234 Maple
   [2.3] =&#38;gt; Berwyn
   [2.4] =&#38;gt; IL
   [2.5] =&#38;gt; 60402
   [2.6] =&#38;gt; United States
   [3] =&#38;gt; this is my awesome comment&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;That is part of a submission I made with this form:&#60;br /&#62;
&#60;a href=&#34;http://gravity.chrishajer.com/testing-the-post/&#34; rel=&#34;nofollow&#34;&#62;http://gravity.chrishajer.com/testing-the-post/&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;If you look at the source of the page, you will see the input_12_1_3 and input_12_1_6 I referenced above, and how they correlate to the [1.3] and [1.6] in the $entry object.&#60;/p&#62;
&#60;p&#62;In your MySQL query line, if your form were identical to mine, you would do this: [EDITED 9/2/2011]&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;[php]
$query = &#38;#39;INSERT INTO affiliates (FirstName, LastName) VALUES (\&#38;#39;&#38;#39;. $entry[&#38;#39;1.3&#38;#39;] . &#38;#39;\&#38;#39;, \&#38;#39;&#38;#39; . $entry[&#38;#39;1.6&#38;#39;] . &#38;#39;\&#38;#39;)&#38;#39;;
mysql_query($query);&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;For me, that resulted in this query being generated:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;INSERT INTO affiliates (FirstName, LastName) VALUES (&#38;#39;Chris2&#38;#39;, &#38;#39;Hajer2&#38;#39;)&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Replace the 1.3 and 1.6 with the id of the form fields from your form and you'll be good to go.  Please post if you need more assistance, or if this works out for you.  Thanks.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>imagebox on "Grabbing $_POST to simulanteously store in a second database"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/grabbing-_post-to-simulanteously-store-in-a-second-database#post-31379</link>
			<pubDate>Mon, 01 Aug 2011 19:27:17 +0000</pubDate>
			<dc:creator>imagebox</dc:creator>
			<guid isPermaLink="false">31379@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Thanks -&#60;/p&#62;
&#60;p&#62;I realize this requires custom PHP...that is not a problem.  I am just having a problem identifying exactly how gform_post_submission works.&#60;/p&#62;
&#60;p&#62;I have placed the following in my functions.php file. I know this is not correct, but I am looking to get put on the right track.&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://www.pastie.org/2306344&#34; rel=&#34;nofollow&#34;&#62;http://www.pastie.org/2306344&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;Thanks
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Carl Hancock on "Grabbing $_POST to simulanteously store in a second database"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/grabbing-_post-to-simulanteously-store-in-a-second-database#post-31306</link>
			<pubDate>Mon, 01 Aug 2011 11:29:47 +0000</pubDate>
			<dc:creator>Carl Hancock</dc:creator>
			<guid isPermaLink="false">31306@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;You have to use the gform_post_submission hook which has access to the Entry Object which contains the data.  You'd then have to write custom PHP to read the values you want from the Entry object and insert them into your database table.&#60;/p&#62;
&#60;p&#62;Here is documentation on the gform_post_submission hook:&#60;br /&#62;
&#60;a href=&#34;http://www.gravityhelp.com/documentation/page/Gform_post_submission&#34; rel=&#34;nofollow&#34;&#62;http://www.gravityhelp.com/documentation/page/Gform_post_submission&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;Here is documentation on the entry object:&#60;br /&#62;
&#60;a href=&#34;http://www.gravityhelp.com/documentation/page/Entry_Object&#34; rel=&#34;nofollow&#34;&#62;http://www.gravityhelp.com/documentation/page/Entry_Object&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;So this requires knowledge of PHP and hook usage to be able to implement it properly.  You want to use the gform_post_submission hook because this is going to give you access to the data AFTER form validation has taken place.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>imagebox on "Grabbing $_POST to simulanteously store in a second database"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/grabbing-_post-to-simulanteously-store-in-a-second-database#post-31270</link>
			<pubDate>Sun, 31 Jul 2011 12:21:19 +0000</pubDate>
			<dc:creator>imagebox</dc:creator>
			<guid isPermaLink="false">31270@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I have the user registration add-on setup and its working great.  However I have a separate affiliate script running outside of the confines of wordpress.  When a user fills out the gravity form and is added to the WP database I need to be able to grab the $_POST entry variables and store them in a separate database for the affiliate script.  I realize this is custom, but I need some guidance on gform_post_submission&#60;/p&#62;
&#60;p&#62;I think after reading the forums that it should be pretty easy to do, but I can't seem to figure out gform_post_submission.  I see that each $_POST is actually stored in and entry array.  Is it as simple as creating a basic MySQL function to store each $entry[]; submission in my second database?
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
