<?xml version="1.0"?><!-- generator="bbPress" -->

<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
>

<channel>
<title>MachForm Community Forums Topic: Send the form data to another php program via the "Redirected URL" feature</title>
<link>https://www.machform.com/forums/</link>
<description>MachForm Community Forums Topic: Send the form data to another php program via the "Redirected URL" feature</description>
<language>en</language>
<pubDate>Tue, 05 May 2026 07:54:13 +0000</pubDate>

<item>
<title>orachat on "Send the form data to another php program via the "Redirected URL" feature"</title>
<link>https://www.machform.com/forums/topic/send-the-form-data-to-another-php-program-via-the-redirected-url-feature#post-12047</link>
<pubDate>Wed, 25 May 2011 05:52:04 +0000</pubDate>
<dc:creator>orachat</dc:creator>
<guid isPermaLink="false">12047@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;I start with &#38;#38; instead of ? in &#34;$form_redirect . '&#38;#38;' . $url_data&#34; because I'm assuming that $form_redirect will already have some parameters (see #2 in the first post), since this is how I use it.  I suppose this part can be improved by checking to see if '?' exists in $form_redirect already, and if not, then use '?' instead of '&#38;#38;'.
&#60;/p&#62;</description>
</item>
<item>
<title>startagl on "Send the form data to another php program via the "Redirected URL" feature"</title>
<link>https://www.machform.com/forums/topic/send-the-form-data-to-another-php-program-via-the-redirected-url-feature#post-12035</link>
<pubDate>Tue, 24 May 2011 07:01:13 +0000</pubDate>
<dc:creator>startagl</dc:creator>
<guid isPermaLink="false">12035@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;form review, did the trick. Thanks.&#60;/p&#62;
&#60;p&#62;Also your code seems to create a malformed post. The data returned starts with a &#38;#38; instead of a ?, did you do that on purpose?&#60;/p&#62;
&#60;p&#62;I also added to following code in case it helps anyone.&#60;/p&#62;
&#60;p&#62;//append the newly created record id to the $url_data stream&#60;br /&#62;
$url_data .= 'RecNo=' . $new_record_id; //unique number for this form submission&#60;/p&#62;
&#60;p&#62;//saves the $url_data to a file so you can inspect it&#60;br /&#62;
file_put_contents(&#34;/(path)/POST_FUNCTIONS.txt&#34;,$url_data,FILE_APPEND);
&#60;/p&#62;</description>
</item>
<item>
<title>orachat on "Send the form data to another php program via the "Redirected URL" feature"</title>
<link>https://www.machform.com/forums/topic/send-the-form-data-to-another-php-program-via-the-redirected-url-feature#post-12033</link>
<pubDate>Tue, 24 May 2011 02:08:33 +0000</pubDate>
<dc:creator>orachat</dc:creator>
<guid isPermaLink="false">12033@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;To answer the question &#34;Does this file get written only if there is a redirected url,&#34;,&#60;br /&#62;
the answer is &#34;yes&#34;.
&#60;/p&#62;</description>
</item>
<item>
<title>orachat on "Send the form data to another php program via the "Redirected URL" feature"</title>
<link>https://www.machform.com/forums/topic/send-the-form-data-to-another-php-program-via-the-redirected-url-feature#post-12032</link>
<pubDate>Tue, 24 May 2011 02:06:01 +0000</pubDate>
<dc:creator>orachat</dc:creator>
<guid isPermaLink="false">12032@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;I've always tested with &#34;form review&#34; on and never thought about it, but I just tested with it off and it does not work.  I didn't realize this. I didn't review the entire code to see where I should put the code because I was referred to post-functions.php. I guess it's a question for the developers as to where this code should go if &#34;form review&#34; is off.
&#60;/p&#62;</description>
</item>
<item>
<title>yuniar on "Send the form data to another php program via the "Redirected URL" feature"</title>
<link>https://www.machform.com/forums/topic/send-the-form-data-to-another-php-program-via-the-redirected-url-feature#post-12029</link>
<pubDate>Mon, 23 May 2011 08:35:40 +0000</pubDate>
<dc:creator>yuniar</dc:creator>
<guid isPermaLink="false">12029@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;I think the code above assume that you need to enable &#34;form review&#34; for your form. So try to enable form review.
&#60;/p&#62;</description>
</item>
<item>
<title>startagl on "Send the form data to another php program via the "Redirected URL" feature"</title>
<link>https://www.machform.com/forums/topic/send-the-form-data-to-another-php-program-via-the-redirected-url-feature#post-12023</link>
<pubDate>Sun, 22 May 2011 09:03:55 +0000</pubDate>
<dc:creator>startagl</dc:creator>
<guid isPermaLink="false">12023@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;I am not sure why but it seems like this code is not getting executed at all. Just for testing I have put in sleep(10000); and it still just jumps to the redirect page without any pause. what the?
&#60;/p&#62;</description>
</item>
<item>
<title>startagl on "Send the form data to another php program via the "Redirected URL" feature"</title>
<link>https://www.machform.com/forums/topic/send-the-form-data-to-another-php-program-via-the-redirected-url-feature#post-12021</link>
<pubDate>Sat, 21 May 2011 18:24:29 +0000</pubDate>
<dc:creator>startagl</dc:creator>
<guid isPermaLink="false">12021@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;I have added the following code to your procedure.&#60;/p&#62;
&#60;p&#62;$mlog = fopen(&#34;test.txt&#34;,&#34;w&#34;);&#60;br /&#62;
fwrite ($mlog, $url_data . &#34;\n&#34;); //for testing only&#60;br /&#62;
fclose($mlog);&#60;/p&#62;
&#60;p&#62;But I can not find the test.txt file anywhere, so&#60;br /&#62;
I created the file and set its permissions to 666. But the file never gets updated.&#60;/p&#62;
&#60;p&#62;Does this file get written only if there is a redirected url, Or does it create the file for every form that is completed?&#60;/p&#62;
&#60;p&#62;Thanks.
&#60;/p&#62;</description>
</item>
<item>
<title>yuniar on "Send the form data to another php program via the "Redirected URL" feature"</title>
<link>https://www.machform.com/forums/topic/send-the-form-data-to-another-php-program-via-the-redirected-url-feature#post-12018</link>
<pubDate>Sat, 21 May 2011 09:01:45 +0000</pubDate>
<dc:creator>yuniar</dc:creator>
<guid isPermaLink="false">12018@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;Thank you for sharing this code!
&#60;/p&#62;</description>
</item>
<item>
<title>orachat on "Send the form data to another php program via the "Redirected URL" feature"</title>
<link>https://www.machform.com/forums/topic/send-the-form-data-to-another-php-program-via-the-redirected-url-feature#post-12016</link>
<pubDate>Sat, 21 May 2011 00:59:41 +0000</pubDate>
<dc:creator>orachat</dc:creator>
<guid isPermaLink="false">12016@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;The following code was written for the following conditions:&#60;br /&#62;
1. MachForm version 2.4&#60;br /&#62;
2. The &#34;Redirected URL&#34; already has some parameters. For example, &#60;a href=&#34;http://xx.xx.xx.xx/process_form_data.php?form_name=template&#38;#38;itemcode=123432&#34; rel=&#34;nofollow&#34;&#62;http://xx.xx.xx.xx/process_form_data.php?form_name=template&#38;#38;itemcode=123432&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;To send the form data to a php program, replace the line&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;$commit_result[&#38;#39;form_redirect&#38;#39;] = $form_redirect;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;in includes/post-functions.php with the following code (probably should be a function instead):&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;$url_data = &#38;#39;&#38;#39;;
$entry_details = get_entry_details($form_id,$new_record_id,&#38;#39;&#38;#39;);
foreach ($entry_details as $data) {
    if ($data[&#38;#39;element_type&#38;#39;] == &#38;#39;textarea&#38;#39;) {
        $data[&#38;#39;value&#38;#39;] = nl2br($data[&#38;#39;value&#38;#39;]); //add br before newline
        $data[&#38;#39;value&#38;#39;] = str_replace(&#38;quot;\r\n&#38;quot;, &#38;#39;&#38;#39;, $data[&#38;#39;value&#38;#39;]); //remove newline because it breaks php
    }
    elseif ($data[&#38;#39;element_type&#38;#39;] == &#38;#39;file&#38;#39;) {
        $data[&#38;#39;value&#38;#39;] = strip_tags($data[&#38;#39;value&#38;#39;], &#38;#39;&#38;lt;a&#38;gt;&#38;#39;); //remove the image tag, but keep href
    }
    elseif ($data[&#38;#39;element_type&#38;#39;] == &#38;#39;checkbox&#38;#39;) {
        $data[&#38;#39;value&#38;#39;] = strip_tags($data[&#38;#39;value&#38;#39;], &#38;#39;&#38;lt;br&#38;gt;&#38;#39;); //remove the image tag, but keep &#38;lt;br&#38;gt;
        $data[&#38;#39;value&#38;#39;] = str_replace(&#38;#39;&#38;#39;, &#38;#39;,&#38;#39;, $data[&#38;#39;value&#38;#39;]); //replace &#38;lt;br&#38;gt; with &#38;#39;,&#38;#39;
        $data[&#38;#39;value&#38;#39;] = preg_replace (&#38;#39;/^ /&#38;#39;, &#38;#39;&#38;#39;, $data[&#38;#39;value&#38;#39;]); //remove the beginning space
        $data[&#38;#39;value&#38;#39;] = preg_replace (&#38;#39;/,$/&#38;#39;, &#38;#39;&#38;#39;, $data[&#38;#39;value&#38;#39;]); //remove the trailing &#38;#39;,&#38;#39;
    }
    elseif ($data[&#38;#39;element_type&#38;#39;] == &#38;#39;phone&#38;#39;) {
        $data[&#38;#39;value&#38;#39;] = str_replace(&#38;#39; &#38;#39;, &#38;#39;&#38;#39;, $data[&#38;#39;value&#38;#39;]); //remove spaces
    }
    elseif ($data[&#38;#39;element_type&#38;#39;] == &#38;#39;address&#38;#39;) {
        $data[&#38;#39;value&#38;#39;] = str_replace(&#38;#39;&#38;#39;, &#38;#39;, &#38;#39;, $data[&#38;#39;value&#38;#39;]); //prefer &#38;#39;,&#38;#39; over &#38;lt;br&#38;gt;
    }               

    //target php program fails to get some data values correctly due to existence of non-alphanumeric characters
    $data[&#38;#39;value&#38;#39;] = urlencode($data[&#38;#39;value&#38;#39;]);

    //replace &#38;#39;&#38;amp;nbsp;&#38;#39; with nothing, because empty fields have &#38;#39;&#38;amp;nbsp;&#38;#39; after using urlencode() previously
    $data[&#38;#39;value&#38;#39;] = str_replace(&#38;#39;%26nbsp%3B&#38;#39;, &#38;#39;&#38;#39;, $data[&#38;#39;value&#38;#39;]);

    $url_data .= $data[&#38;#39;label&#38;#39;] . &#38;#39;=&#38;#39; . &#38;#39;&#38;quot;&#38;#39; . $data[&#38;#39;value&#38;#39;] . &#38;#39;&#38;quot;&#38;#39; . &#38;#39;&#38;#38;&#38;#39;;

    //fwrite ($mlog, $url_data . &#38;quot;\n&#38;quot;); //for testing only
}               

$commit_result[&#38;#39;form_redirect&#38;#39;] = $form_redirect . &#38;#39;&#38;#38;&#38;#39; . $url_data;&#60;/code&#62;&#60;/pre&#62;</description>
</item>

</channel>
</rss>
