To prevent misusing inputs for SQL injection
<?php echo isset($_POST['name']) ? htmlspecialchars($_POST['name'], ENT_QUOTES) : ''; ?>
You should wrap the output in htmlspecialchars() for security.
https://radu.link/keep-form-data-submit-refresh-php/