How can PHP developers prevent multiple empty emails from being sent to the admin when a page is refreshed?

To prevent multiple empty emails from being sent to the admin when a page is refreshed, PHP developers can implement a check to ensure that the email is only sent once. This can be achieved by setting a flag or session variable after the email is sent, and checking this flag before sending the email again.

<?php
session_start();

if (!isset($_SESSION['email_sent'])) {
    // Send email to admin
    // Your email sending code here

    $_SESSION['email_sent'] = true;
}
?>