final working todo.php with functions added