<div class="form_panel" align=left >
	<form name="<?php echo $form_key_id; ?>_form_<?php echo $_REQUEST[$form_key_id];?>_<?php echo $_REQUEST["relationkey"];?>"  >
	<div class="form_panel_title">






		<div class='fa-stack fa-lg'  style='cursor:pointer;float:left;'  onclick="mon_submit_form('<?php echo $form_key_id; ?>_form_<?php echo $_REQUEST[$form_key_id];?>_<?php echo $_REQUEST["relationkey"];?>','<?php echo $this_url; ?>')" >
			<i class="fa fa-square fa-stack-2x color_blue"  ></i><i class="fa fa-save fa-stack-1x color_white" ></i>
		</div>

		<div class='fa-stack fa-lg'  style='cursor:pointer;float:left;'  onclick="mon_copy_form('<?php echo $form_key_id; ?>_form_<?php echo $_REQUEST[$form_key_id];?>_<?php echo $_REQUEST["relationkey"];?>')" >
			<i class="fa fa-square fa-stack-2x color_grey"  ></i><i class="fa fa-copy fa-stack-1x color_white" ></i>
		</div>

		<div class='fa-stack fa-lg'  style='cursor:pointer;float:left;'  onclick="mon_paste_form('<?php echo $form_key_id; ?>_form_<?php echo $_REQUEST[$form_key_id];?>_<?php echo $_REQUEST["relationkey"];?>')" >
			<i class="fa fa-square fa-stack-2x color_grey"  ></i><i class="fa fa-paste fa-stack-1x color_white" ></i>
		</div>

		<div class='fa-stack fa-lg'  style='cursor:pointer;float:right;'  onclick="mon_send_get('<?php echo $this_url;?>','?<?php echo "offset=".$offset.$extraurl; ?>','div_main')" >
			<i class="fa fa-square fa-stack-2x color_red"  ></i><i class="fa fa-times fa-stack-1x color_white" ></i>
		</div>






	</div>
	<div class="form_panel_content">


		<?php
			//IMPORTANT! - Ensure the id is exist after creation!

			echo "<input type='hidden' name='".$form_key_id."' value='".$_REQUEST[$form_key_id]."' >";
			echo "<input type='hidden' name='offset' value='$offset' >";
			echo "<input type='hidden' name='action' value='".$_REQUEST["action"]."' >";
			echo "<input type='hidden' name='relationkey' value='".$_REQUEST["relationkey"]."' >";
			echo "<input type='hidden' name='relationkey2' value='".$_REQUEST["relationkey2"]."' >";
			echo "<input type='hidden' name='relationkey3' value='".$_REQUEST["relationkey3"]."' >";
			echo "<input type='hidden' name='search_word' value='".$_REQUEST["search_word"]."' >";
			echo "<input type='hidden' name='search_field' value='".$_REQUEST["search_field"]."' >";
			echo "<input type='hidden' name='tab' value='".$_REQUEST["tab"]."' >";
			echo "<input type='hidden' name='".$tab_key_id."' value='".$_REQUEST[$tab_key_id]."' >";


		?>


		<?php
		if($_REQUEST["action"]=="EDIT")
		{
			//echo "Update";
		}
		else
		{
			//echo "Create";
		}

		?>


		<?php
		for($i=1;$i<=count($form_field);$i++)
		{

			if($form_field_separator[$i]!="")
			{
				echo "<div class='form_field_separator' >";


				echo "<font size=3><b>".$form_field_separator[$i]."</b></font>";

				echo "</div>";
			}



			echo "<div class='form_field_row' >";



				//------------------------label--------------------------------------------------



				echo "<div class='form_field_label' >";

				if($form_field_checking[$i]=="COMPULSORY")
				{

					echo "<b>".$form_field_label[$i]."</b>";
					//echo " <font class='compulsory_note' >*</font> ";


				}
				else
				{

					echo $form_field_label[$i];


				}
				echo "</div>";



				//-------------------------input-------------------------------------------------


				echo "<div class='form_field_input' >";


					if($form_field_type[$i]=="TEXT")
					{
						echo "<input type=\"text\" class=\"".$form_field_class[$i]."\" name=\"".$form_field[$i]."\" id=\"id_".$form_field[$i]."\" value=\"".$form_field_value[$i]."\" placeholder=\"".$form_field_hints[$i]."\" >";
					}

					if($form_field_type[$i]=="PRICE")
					{
						echo "<input type=\"text\" class=\"".$form_field_class[$i]."\" name=\"".$form_field[$i]."\" id=\"id_".$form_field[$i]."\" value=\"".$form_field_value[$i]."\" placeholder=\"".$form_field_hints[$i]."\" >";
					}

					if($form_field_type[$i]=="QUANTITY")
					{
						echo "<input type=\"text\" class=\"".$form_field_class[$i]."\" name=\"".$form_field[$i]."\" id=\"id_".$form_field[$i]."\" value=\"".$form_field_value[$i]."\" placeholder=\"".$form_field_hints[$i]."\" >";
					}

					if($form_field_type[$i]=="DATE_START")
					{
						echo "<input type=\"text\" class=\"".$form_field_class[$i]."\" name=\"".$form_field[$i]."\" id=\"id_".$form_field[$i]."\" value=\"".$form_field_value[$i]."\" onfocus=blur() >";
						echo "<a href=\"javascript:void(0)\" onclick=\"if(self.gfPop)gfPop.fStartPop(document.".$form_key_id."_form_".$_REQUEST[$form_key_id]."_".$_REQUEST["relationkey"].".".$form_field[$i].",document.".$form_key_id."_form_".$_REQUEST[$form_key_id]."_".$_REQUEST["relationkey"].".".$form_field[$i+1].");"."return false;\" HIDEFOCUS>";
						echo " <span class='fa fa-calendar fa-lg' style='color:#000;'></span>";
						echo "</a>";
					}

					if($form_field_type[$i]=="DATE_END")
					{
						echo "<input type=\"text\" class=\"".$form_field_class[$i]."\" name=\"".$form_field[$i]."\" id=\"id_".$form_field[$i]."\" value=\"".$form_field_value[$i]."\" onfocus=blur() >";
						echo "<a href=\"javascript:void(0)\" onclick=\"if(self.gfPop)gfPop.fEndPop(document.".$form_key_id."_form_".$_REQUEST[$form_key_id]."_".$_REQUEST["relationkey"].".".$form_field[$i-1].",document.".$form_key_id."_form_".$_REQUEST[$form_key_id]."_".$_REQUEST["relationkey"].".".$form_field[$i].");"."return false;\" HIDEFOCUS>";
						echo " <span class='fa fa-calendar fa-lg' style='color:#000;'></span>";
						echo "</a>";
					}


					if($form_field_type[$i]=="DATE")
					{
						echo "<input type=\"text\" class=\"".$form_field_class[$i]."\" name=\"".$form_field[$i]."\" id=\"id_".$form_field[$i]."\" value=\"".$form_field_value[$i]."\" onfocus=blur() > ";
						echo "<a href=\"javascript:void(0)\" onclick=\"if(self.gfPop)gfPop.fPopCalendar(document.".$form_key_id."_form_".$_REQUEST[$form_key_id]."_".$_REQUEST["relationkey"].".".$form_field[$i].");"."return false;\" HIDEFOCUS>";
						echo " <span class='fa fa-calendar fa-lg' style='color:#000;'></span>";
						echo "</a>";
					}


					if($form_field_type[$i]=="TIME")
					{
						echo "<input type=\"text\" class=\"".$form_field_class[$i]."\" name=\"".$form_field[$i]."\" id=\"id_".$form_field[$i]."\" value=\"".$form_field_value[$i]."\" onfocus=blur() >";
						echo "<a href=\"javascript:void(0)\" onclick=\"if(self.gfPop2)gfPop2.fPopCalendar2(document.".$form_key_id."_form_".$_REQUEST[$form_key_id]."_".$_REQUEST["relationkey"].".".$form_field[$i].");"."return false;\" HIDEFOCUS>";
						echo " <span class='fa fa-clock-o fa-lg' style='color:#000;'></span>";
						echo "</a>";

					}




					if($form_field_type[$i]=="PASSWORD")
					{
						echo "<input type=\"password\" class=\"".$form_field_class[$i]."\" name=\"".$form_field[$i]."\" id=\"id_".$form_field[$i]."\" value=\"".$form_field_value[$i]."\" placeholder=\"Leave blank if no change.\">";
						//echo "<br><font color=FF0000 size=1>(Leave blank if not reset)</font>";
					}
					if($form_field_type[$i]=="TEXTAREA")
					{
						echo "<textarea  class=\"".$form_field_class[$i]."\" name=\"".$form_field[$i]."\"  id=\"id_".$form_field[$i]."\" placeholder=\"".$form_field_hints[$i]."\" >".$form_field_value[$i]."</textarea>";
					}
					if($form_field_type[$i]=="DROPDOWN")
					{
						echo "<select class=\"".$form_field_class[$i]."\" name=\"".$form_field[$i]."\"  id=\"id_".$form_field[$i]."\" >";


						echo "<option value='0' >".$form_field_hints[$i]."</option>";
						if($form_field_dropdown_option[$i]=="KEYWORD")
						{

						//for($j=1;$j<=count($mon_keyword_list[$form_field_dropdown_option_values[$i]]);$j++)
						//	{



							foreach($mon_keyword_list[$form_field_dropdown_option_values[$i]] as $mon_key=>$mon_value)
							{
								if($form_field_value[$i]==$mon_key)
									{
										echo "<option value='$mon_key' selected >".$mon_value."</option>";
									}
								else
									{
										echo "<option value='$mon_key' >".$mon_value."</option>";
									}
							}

						}
						if($form_field_dropdown_option[$i]=="SQL")
						{

							$query_select=$form_field_dropdown_option_values[$i];
							$result_select=mysqli_query($dbconn,$query_select) or die("Retrieval failed- Err msg  ". mysqli_error($dbconn));
							while($line_select=mysqli_fetch_array($result_select,MYSQLI_ASSOC))
							{
								if($form_field_value[$i]==$line_select["value"])
									{
										echo "<option value='".$line_select["value"]."' selected >".$line_select["text"]."</option>";
									}
								else
									{
										echo "<option value='".$line_select["value"]."' >".$line_select["text"]."</option>";
									}
							}

						}



						echo "</select>";
					}

					if($form_field_type[$i]=="FILE")
					{
						if($_REQUEST[$form_key_id]!="")
						{
							echo "<iframe  class=\"upload_iframe\" src=\"mod/fuploader/index.php?mod=".$form_key_id."&mod_id=".$_REQUEST[$form_key_id]."&mod_field=".$form_field[$i]."\" frameborder=0 ></iframe>";
						}
						else
						{
							echo "<font size=2 color=FF0000 >You can only upload file after saving this record</font>";
						}
					}

					if($form_field_type[$i]=="FILE_PHOTO")
					{
						if($_REQUEST[$form_key_id]!="")
						{
							echo "<iframe  class=\"upload_iframe\" src=\"mod/uploader/index.php?mod=".$form_key_id."&mod_id=".$_REQUEST[$form_key_id]."&mod_field=".$form_field[$i]."\" frameborder=0 ></iframe>";


						}
						else
						{
							echo "<font size=2 color=FF0000 >You can only upload file after saving this record</font>";
						}
					}






				echo "</div>";

			echo "</div>";



	 }
	?>




</div>
</form>
</div>
