<?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: concantenate two fields to fill another field</title>
<link>https://www.machform.com/forums/</link>
<description>MachForm Community Forums Topic: concantenate two fields to fill another field</description>
<language>en</language>
<pubDate>Sun, 03 May 2026 23:06:26 +0000</pubDate>

<item>
<title>trekmadone2008 on "concantenate two fields to fill another field"</title>
<link>https://www.machform.com/forums/topic/concantenate-two-fields-to-fill-another-field#post-11282</link>
<pubDate>Tue, 25 Jan 2011 15:21:45 +0000</pubDate>
<dc:creator>trekmadone2008</dc:creator>
<guid isPermaLink="false">11282@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;Hello, I tried this and i get the following error :&#60;/p&#62;
&#60;p&#62;INSERT INTO &#60;code&#62;ap_form_1&#60;/code&#62; (element_1,element_2,element_3,ip_address,date_created) VALUES ('2583','5900','code25835900','84.198.91.208','2011-01-25 08:20:09'); Query failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'element_1,element_2,element_3,ip_ad' at line 1&#60;/p&#62;
&#60;p&#62;Can you help me ?
&#60;/p&#62;</description>
</item>
<item>
<title>redityo on "concantenate two fields to fill another field"</title>
<link>https://www.machform.com/forums/topic/concantenate-two-fields-to-fill-another-field#post-5819</link>
<pubDate>Tue, 12 May 2009 23:31:05 +0000</pubDate>
<dc:creator>redityo</dc:creator>
<guid isPermaLink="false">5819@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;You need to edit &#34;includes/post-functions.php&#34; file to do this. Let say you have this information :&#60;/p&#62;
&#60;p&#62;Field &#34;A&#34; element id = 1&#60;br /&#62;
Field &#34;B&#34; element id = 2&#60;br /&#62;
Field &#34;C&#34; element id = 3&#60;br /&#62;
Form id = 53&#60;/p&#62;
&#60;p&#62;Then go around line 939 ~ 951, you will see this code :&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;foreach ($table_data as $key=&#38;gt;$value){

	if($value == &#38;#39;&#38;#39;){ //don&#38;#39;t insert blank entry
		continue;
	}
	$value		    = mysql_real_escape_string($value);
	$field_list    .= &#38;quot;&#38;lt;code&#38;gt;$key&#38;lt;/code&#38;gt;,&#38;quot;;
	$field_values  .= &#38;quot;&#38;#39;$value&#38;#39;,&#38;quot;;

	if(!empty($value)){
		$has_value = true;
	}
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;replace those code with this one &#60;/p&#62;
&#60;pre&#62;&#60;code&#62;$temp = &#38;#39;&#38;#39;;
$temp_field_list= &#38;#39;&#38;#39;;
$temp_field_values = &#38;#39;&#38;#39;;
if($form_id == &#38;#39;53&#38;#39;) {
	$element_1_data = mysql_real_escape_string(ereg_replace(&#38;#39; &#38;#39;,&#38;#39;&#38;#39;,$table_data[&#38;#39;element_1&#38;#39;]));
	$element_2_data = mysql_real_escape_string(ereg_replace(&#38;#39; &#38;#39;,&#38;#39;&#38;#39;,$table_data[&#38;#39;element_2&#38;#39;]));
	if (array_key_exists(&#38;#39;element_3&#38;#39;,$table_data))  {
		$temp  = &#38;#39;code&#38;#39; . $element_1_data . $element_2_data ;
	}
	else {
		$temp  = &#38;#39;code&#38;#39; . $element_1_data . $element_2_data ;
		$temp_field_list = &#38;quot;&#38;lt;code&#38;gt;element_3&#38;lt;/code&#38;gt;,&#38;quot;;
		$temp_field_values = &#38;quot;&#38;#39;&#38;quot;.$temp.&#38;quot;&#38;#39;,&#38;quot;;
	}
}

foreach ($table_data as $key=&#38;gt;$value){

	if($value == &#38;#39;&#38;#39; &#38;#38;&#38;#38; ($form_id != &#38;#39;53&#38;#39; &#38;#38;&#38;#38; $key != &#38;#39;element_3&#38;#39;)){ //don&#38;#39;t insert blank entry
		continue;
	}

	$value		    = mysql_real_escape_string($value);
	$field_list    .= &#38;quot;&#38;lt;code&#38;gt;$key&#38;lt;/code&#38;gt;,&#38;quot;;

	if ($form_id == &#38;#39;53&#38;#39; &#38;#38;&#38;#38; $key == &#38;#39;element_3&#38;#39;)
		$field_values  .= &#38;quot;&#38;#39;$temp&#38;#39;,&#38;quot;;
	else
		$field_values  .= &#38;quot;&#38;#39;$value&#38;#39;,&#38;quot;;

	if(!empty($value)){
		$has_value = true;
	}
}

if ($form_id == &#38;#39;53&#38;#39; &#38;#38;&#38;#38; $temp_field_values != &#38;#39;&#38;#39;)
{
	$field_list .=  $temp_field_list;
	$field_values .= $temp_field_values;
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;make sure you adjust form id and element id number with yours. Also it will remove &#34;space&#34; character in field &#34;A&#34; or field &#34;B&#34;.
&#60;/p&#62;</description>
</item>
<item>
<title>drbobtampa on "concantenate two fields to fill another field"</title>
<link>https://www.machform.com/forums/topic/concantenate-two-fields-to-fill-another-field#post-5801</link>
<pubDate>Sun, 10 May 2009 23:40:05 +0000</pubDate>
<dc:creator>drbobtampa</dc:creator>
<guid isPermaLink="false">5801@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;Suppose form-user enters text field A= &#34;XYX&#34; and text field B= &#34;123&#34;.  &#60;/p&#62;
&#60;p&#62;I want to populate a hidden, administrator-only third field, C,  like this:&#60;br /&#62;
 concatenate(&#34;code&#34;+A+B) to yield text field C= &#34;codeXYZ123&#34;.  &#60;/p&#62;
&#60;p&#62;What code and which php can I do that in?&#60;br /&#62;
As a bonus question, how can I convert &#34;XY Z&#34; into &#34;XYZ)  (that is, remove blanks at the same time)?&#60;/p&#62;
&#60;p&#62;Many thanks!
&#60;/p&#62;</description>
</item>

</channel>
</rss>
