Location: PHPKode > scripts > ER Manager > ermanager/edit_forma_info.php
<?PHP

require "functions.php";

localnet_or_die(); //check for localnet

//save data
if($save) {
	//prepare data
	
	$SETS = "
		company_id      = '".addslashes($company_id)."',
		year			= '".addslashes($year)."',
		interest		= '".addslashes($interest)."',
		interest_nextyear		= '".addslashes($interest_nextyear)."',
		reason_late			= '".addslashes($reason_late)."',
		reason_small			= '".addslashes($reason_small)."',
		reason_staff			= '".addslashes($reason_staff)."',
		reason_cost			= '".addslashes($reason_cost)."',
		reason			= '".addslashes($reason)."',
		interest_alternative		= '".addslashes($interest_alternative)."',
		proposals		= '".addslashes($proposals)."',
		participation	= '".addslashes($participation)."',
		reminder			= '".addslashes($reminder)."'
	";

if($id) {	
	  //update existing record
		$INSERT = "UPDATE er_forma SET ".$SETS." WHERE id = ".$id."";
		runSQL($INSERT);
	} else {
$INSERT = "INSERT INTO er_forma SET ".$SETS." ";
runSQL($INSERT); 

//get id for inserted data
$SELECT = "SELECT id from er_forma ORDER BY id desc LIMIT 1";
$result = runSQL($SELECT);
$id = $result[0][id];
} // end else
		
} // end if($save)

if( ($id and !$save) or !$id) {

//load existing data
if($id and !$save) {
	$SELECT = "SELECT * FROM er_forma WHERE id = ".$id."";
	$entity = runSQL($SELECT);
}

//prepare templates
$smarty->assign('http_error',$CLIENTERROR);
tpl_header();
tpl_edit_forma($entity);
tpl_footer();

//display templates
$smarty->display('header.tpl');
flush();
$smarty->display('edit_forma_info.tpl');
$smarty->display('footer.tpl');
} //end if($id and !save)

else {
  $id = $company_id;
  require "company.php";
}

?>
Return current item: ER Manager