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

require "functions.php";

localnet_or_die(); //check for localnet

//save data
if($save) {
	//prepare data
	$SETS = "
		company_id      = '".addslashes($company_id)."',
		todo_title      = '".addslashes($todo_title)."',
		todo      = '".addslashes($todo)."',
		deadline      = '$year-$month-$day',
		status      = '".addslashes($status)."'
	";

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

//get id for inserted data
$SELECT = "SELECT id from er_todos 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_todos WHERE id = ".$id."";
	$entity = runSQL($SELECT);
}

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

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

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

?>
Return current item: ER Manager