How can you ensure that the session_id remains the same when submitting a form to itself in PHP?

When submitting a form to itself in PHP, you can ensure that the session_id remains the same by starting the session at the beginning of the script and using session_regenerate_id(false) to prevent the session id from changing on each request.

<?php
session_start();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    // Process form data
}

session_regenerate_id(false);
?>