$last_id = (int)$_GET['id'];всегда будет 0
параметр не передается
$.post('/add_new.php',data);так же и это бесполезный кусок. условие всегда будет true
$error = array();
if(empty($error)) { $last_id = (int)$_GET['id'];$.post('/add_new.php',data);$error = array();
if(empty($error)) {