<?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: Fatal error: Can&#039;t use function return value in write context</title>
		<link>https://legacy.forums.gravityhelp.com/topic/fatal-error-cant-use-function-return-value-in-write-context</link>
		<description>Gravity Support Forums Topic: Fatal error: Can&#039;t use function return value in write context</description>
		<language>en-US</language>
		<pubDate>Thu, 23 Apr 2026 11:16:43 +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/fatal-error-cant-use-function-return-value-in-write-context" rel="self" type="application/rss+xml" />

		<item>
			<title>Chris Hajer on "Fatal error: Can&#039;t use function return value in write context"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/fatal-error-cant-use-function-return-value-in-write-context#post-42700</link>
			<pubDate>Thu, 01 Dec 2011 02:24:26 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">42700@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Glad you got that working.  Thanks for the update. I'll be sure to let David know.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>thepurplepatriot on "Fatal error: Can&#039;t use function return value in write context"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/fatal-error-cant-use-function-return-value-in-write-context#post-42698</link>
			<pubDate>Thu, 01 Dec 2011 02:20:13 +0000</pubDate>
			<dc:creator>thepurplepatriot</dc:creator>
			<guid isPermaLink="false">42698@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;David, I got it to work finally.  Two things:&#60;/p&#62;
&#60;p&#62;[1] There was also an issue with using isset(). I remove and re-wrote some of the logic.&#60;br /&#62;
[2] I was incorrectly referencing the two radio button form fields:  'input_1_1' should have been 'input_1' and 'input_1_5' should have been 'input_5'.&#60;/p&#62;
&#60;p&#62;Sweet success!  Thanks again for getting me started down the right direction!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Chris Hajer on "Fatal error: Can&#039;t use function return value in write context"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/fatal-error-cant-use-function-return-value-in-write-context#post-42688</link>
			<pubDate>Thu, 01 Dec 2011 01:33:20 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">42688@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I found this at stackexchange as well:&#60;br /&#62;
&#60;a href=&#34;http://stackoverflow.com/questions/1532693/weird-php-error-cant-use-function-return-value-in-write-context&#34; rel=&#34;nofollow&#34;&#62;http://stackoverflow.com/questions/1532693/weird-php-error-cant-use-function-return-value-in-write-context&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;Can't use &#34;empty&#34; on a function return as you're doing in the first example.  However, the line number will make it more clear.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Chris Hajer on "Fatal error: Can&#039;t use function return value in write context"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/fatal-error-cant-use-function-return-value-in-write-context#post-42687</link>
			<pubDate>Thu, 01 Dec 2011 01:30:29 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">42687@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Can you post your whole functions.php to pastebin.com or pastie.org, and then post the full error message, with line number?  It should help pinpoint the cause of the error.  Or, with the line number, post the line of code creating the error.  That's not always foolproof, because the error could have occurred earlier, but it should work in this case.  Thank you.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>thepurplepatriot on "Fatal error: Can&#039;t use function return value in write context"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/fatal-error-cant-use-function-return-value-in-write-context#post-42643</link>
			<pubDate>Wed, 30 Nov 2011 19:57:10 +0000</pubDate>
			<dc:creator>thepurplepatriot</dc:creator>
			<guid isPermaLink="false">42643@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Thank you for your very quick reply, David!  I made two changes, based on your suggestions.  I modified the logic and removed the empty() function, and added the two $form objects.  However, I still got the same Fatal Error message, and am stumped.  Did I make incorrect changes?&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;if (!isset(rgpost($input_field_1)))
	{
		if (rgpost($input_field_5) == &#38;quot;Schofield&#38;quot; &#124;&#124; rgpost($input_field_5) == &#38;quot;Wausau&#38;quot; &#124;&#124; rgpost($input_field_5) == &#38;quot;Weston&#38;quot; &#124;&#124; rgpost($input_field_5) == &#38;quot;Any&#38;quot;)
		{
			$to = &#38;#39;emailname4@email.com&#38;#39;;
			$subject = &#38;#39;Online Contact Form - No Subject Selected - Look at Location Preference&#38;#39;;
		}
		if (rgpost($input_field_5) == &#38;quot;&#38;quot; &#124;&#124; rgpost($input_field_5) == NULL)
		{
			$to = &#38;#39;emailname5@email.com&#38;#39;;
			$subject = &#38;#39;Online Contact Form - No Subject Selected - No Question or Location Preference&#38;#39;;
		}
	}

$form[&#38;#39;notification&#38;#39;][&#38;#39;to&#38;#39;] = $to;
$form[&#38;#39;notification&#38;#39;][&#38;#39;message&#38;#39;] = $subject;
    // return the modified form object
    return $form;&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>David Smith on "Fatal error: Can&#039;t use function return value in write context"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/fatal-error-cant-use-function-return-value-in-write-context#post-42630</link>
			<pubDate>Wed, 30 Nov 2011 19:24:14 +0000</pubDate>
			<dc:creator>David Smith</dc:creator>
			<guid isPermaLink="false">42630@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi purplepatriot,&#60;/p&#62;
&#60;p&#62;Two things I noticed:&#60;/p&#62;
&#60;ol&#62;
&#60;li&#62;the PHP empty() function can not evaluate the return value of a function. In the case where you are using it, you probably don't need it so I'd recommend dropping it.&#60;/li&#62;
&#60;li&#62;I see that you are returning the $subject object correctly; however, it doesn't appear that you ever set the $to and $form variables to their respective properties in the form object. If you're updating the Admin notification you can do so like this:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;[php]
$form[&#38;#39;notification&#38;#39;][&#38;#39;to&#38;#39;] = $to;
$form[&#38;#39;notification&#38;#39;][&#38;#39;message&#38;#39;] = $subject;&#60;/code&#62;&#60;/pre&#62;
&#60;/li&#62;
&#60;/ol&#62;</description>
		</item>
		<item>
			<title>thepurplepatriot on "Fatal error: Can&#039;t use function return value in write context"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/fatal-error-cant-use-function-return-value-in-write-context#post-42612</link>
			<pubDate>Wed, 30 Nov 2011 18:36:42 +0000</pubDate>
			<dc:creator>thepurplepatriot</dc:creator>
			<guid isPermaLink="false">42612@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hello GF Support!&#60;/p&#62;
&#60;p&#62;Wonderful product!  Thank you!  I've searched the forums, and have not found an answer to my issue.  On my contact form are two radio buttons.  Depending on what a user selects in those two radio buttons, the email would be routed to a different email address with a custom subject line.  I cobbled together some code based on reading other GF documentation and forum responses, and using the editor in the WP admin area, I pasted this code in my functions.php file, and when I updated the file I got the error message in the subject line.  Here is my code:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;add_filter(&#38;#39;gform_pre_submission_filter_1&#38;#39;, &#38;#39;modify_sendto_subject&#38;#39;);
function modify_sendto_subject($form){

	// my form uses input_1 for the select box.  Your form may be different.  Change it here as necessary
	$input_field_1 = &#38;#39;input_1_1&#38;#39;;
	$input_field_5 = &#38;#39;input_1_5&#38;#39;;

	// clear out any default Send To email addresses or subject lines from the form builder
	$to = &#38;#39;&#38;#39;;
	$subject = &#38;#39;&#38;#39;;

	// Check the form submission for the radio buttons. If there is a value in $input_field_1, then modify the Subject line and the Send To email address
	if (isset(rgpost($input_field_1)))
	{
		// rgpost is a safe way of accessing the $_POST values
		if (rgpost($input_field_1) == &#38;quot;Loans&#38;quot;)
		{
			$to = &#38;#39;emailname1@email.com&#38;#39;;
			$subject = &#38;#39;Online Contact Form - Loans&#38;#39;;
		}
		if (rgpost($input_field_1) == &#38;quot;General Banking&#38;quot;)
		{
			$to = &#38;#39;emailname2@email.com&#38;#39;;
			$subject = &#38;#39;Online Contact Form - General Banking&#38;#39;;
		}
		if (rgpost($input_field_1) == &#38;quot;Web&#38;quot;)
		{
			$to = &#38;#39;emailname3@email.com&#38;#39;;
			$subject = &#38;#39;Online Contact Form - Web&#38;#39;;
		}
	}

// If no value was selected for the first radio button, then modify the Subject line on whether or not a location preference was or was not selected

	if (!isset(rgpost($input_field_1)))
	{
		if (!empty(rgpost($input_field_5)))
		{
			$to = &#38;#39;emailname4@email.com&#38;#39;;
			$subject = &#38;#39;Online Contact Form - No Subject Selected - Look at Location Preference&#38;#39;;
		}
		if (rgpost($input_field_5) == &#38;quot;&#38;quot; &#124;&#124; rgpost($input_field_5) == NULL)
		{
			$to = &#38;#39;emailname5@email.com&#38;#39;;
			$subject = &#38;#39;Online Contact Form - No Subject Selected - No Question or Location Preference&#38;#39;;
		}
	}

    // return the modified form object
    return $form;
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Is my code bad?  Is there a form setting I need to enable (or disable)?  If necessary, here is a link to the form: &#60;a href=&#34;http://dev.coolwatercreative.com/isb/contact-us/phone-numbers-email/&#34; rel=&#34;nofollow&#34;&#62;http://dev.coolwatercreative.com/isb/contact-us/phone-numbers-email/&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;Thank you!
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
