What is the best practice for setting default values in a PHP form field within a CMS?

When setting default values in a PHP form field within a CMS, it is best practice to check if the field has already been submitted before setting a default value. This ensures that the default value is only displayed when the form is initially loaded and not when the form is submitted with user input.

<?php
// Check if the form has been submitted
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $field_value = $_POST["field_name"];
} else {
    // Set default value if form has not been submitted
    $field_value = "default_value";
}
?>

<input type="text" name="field_name" value="<?php echo $field_value; ?>">