Online submission fprms not working with PHP v8

My online submission pages no longer work after upgrading to PHP v8. After pressing Submit, screen then turns white and no email sent with the submitted info. Screen is not supposed to turn white. After switching back to PHP 7.4, everything worked normally again. I have many online submission pages which all use the same code. The code never had any issues with any version of PHP dating back to 2011. Attached is one of the PHP programs. How can it be edited so it will work with PHP v8 ?

My online submission pages no longer work after upgrading to PHP v8. After pressing Submit, screen then turns white and no email sent with the submitted info. Screen is not supposed to turn white. After switching back to PHP 7.4, everything worked normally again. I have many online submission pages which all use the same code. The code never had any issues with any version of PHP dating back to 2011. Attached is one of the PHP programs. How can it be edited so it will work with PHP v8 ?
<?php
// grab recaptcha library
require_once "recaptchalib.php"; 
// foreach ($_POST as $key => $value) {
    //echo '<p><strong>' . $key.':</strong> '.$value.'</p>';
  // }
// your secret key
$secret = "6LeW4RQUAAAAAJ4NvgWIKJc4b-AeKp6LcLFCFQoS"; 

// empty response
$response = null; 

// check secret key
$reCaptcha = new ReCaptcha($secret); 
// if submitted check response
if ($_POST["g-recaptcha-response"]) { 
   $response = $reCaptcha->verifyResponse( 
          $_SERVER["REMOTE_ADDR"], 
       $_POST["g-recaptcha-response"] 
    ); 
} 
if ($response != null && $response->success) { 

$subject = "Showing Scheduling";
$message = "RadiantNewHorizonHomes.com Showing Scheduling" . "\r\n" . "\r\n" .
"Name: " . $_POST['ShowingName'] . "\r\n" .

"Phone Number : " . $_POST['ShowingPhone1'] . "\r\n" .

"E-mail Address: " . $_POST['ShowingEmail'] . "\r\n" .
"Properties wants to see: " . $_POST['ShowingHomes'] . "\r\n" .
"Date(s)/Time(s) wants to see them: " . $_POST['ShowingTimes'] . "\r\n" .






"Questions or Comments: " . $_POST['ShowingQuestions'] . "\r\n" .

"How Heard About Us: " . $_POST['ShowingHearing'] . "\r\n" .

$from = $_POST['ShowingEmail'];
$headers = "From: $from" . "\r\n";

$to = "david.tigner@radiantnewhorizonhomes.com";
mail($to,$subject,$message,$headers);


} else { } 

?>