<?
include_once("./_common.php");

$code_chk = sql_fetch("select * from `xe_menu` where `code` = '$_POST[code]'");

if($code_chk){
	$sql = "update xe_menu set 
				name = '$_POST[name]',
				level = '$_POST[level]',
				target = '$_POST[target]',
				visible = '$_POST[visible]',
				link = '$_POST[link]',
				link_id = '$_POST[link_id]',
				`theme` = '$_POST[theme]',
				`order` = '$_POST[order]'
			where code = '$_POST[code]' ";
	sql_query($sql);
}else{
	$sql = "insert into xe_menu set 
				code = '$_POST[code]',
				name = '$_POST[name]',
				level = '$_POST[level]',
				target = '$_POST[target]',
				link = '$_POST[link]',
				link_id = '{$_POST[link_id]}',
				visible = '$_POST[visible]',
				`theme` = '$_POST[theme]',
				`order` = '$_POST[order]' ";
	sql_query($sql);
}
goto_url("./xe_menu_edit.php?code=$_POST[code]");
?>