What are the key differences in the logic flow between inserting a new record and updating an existing record in PHP form processing?

When inserting a new record in PHP form processing, the logic flow involves checking if the record already exists before inserting it into the database. On the other hand, when updating an existing record, the logic flow involves first checking if the record exists, then updating the existing record with the new data provided in the form.

// Inserting a new record
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    // Check if the record already exists
    // If not, insert the new record into the database
}

// Updating an existing record
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    // Check if the record exists
    // If it does, update the existing record with the new data provided in the form
}