Need help for migration from php 7.4 to 8.2 + mysql [closed]

Need help for migration of php code from 7.4 to 8.2

Expecting new code for php 8.2

Hi friends,
I have a simple feedback form.
When the Send button is pressed, it will post the form data and update the feedback table.
Its working in PHP 7.4
When i have uploaded the code to cpanel, Its not updating the table.
Cpanel is having version PHP 8.1, 8.2 and 8.3

Can some body help me with the new coding for 8.2


<?php
$booknoworsave =0;

   if ($_SERVER['REQUEST_METHOD'] == 'POST')
   {
      $mysql_server = 'localhost';
      $mysql_database = 'db1';
      $mysql_table = 'feedback';
      $mysql_username = 'admin';
      $mysql_password = 'password';
      $eol = "n";

if(isset($_POST['Send']))
{
$booknoworsave = $_POST['Send'];
}
global $booknoworsave;


 if($booknoworsave == "Send")
{

//Input sanitization to replace special characters
      $search = array("ä", "Ä", "ö", "Ö", "ü", "Ü", "ß", "!", "§", "$", "%", "&", "/", "x00", "^", "°", "x1a", "-", """, " ", "\", "", "x0B", "t", "n", "r", "(", ")", "=", "?", "`", "*", "'", ":", ";", ">", "<", "{", "}", "[", "]", "~", "²", "³", "~", "µ", "@", "|", "<", "+", "#", ".", "´", "+", ",");
      $replace = array("ae", "Ae", "oe", "Oe", "ue", "Ue", "ss");
      foreach($_POST as $name=>$value)
      {
         $name = str_replace($search, $replace, $name);
         $name = strtoupper($name);

         $form_data[$name] = $value;
  
      }
//input sanitization ends here

//Create database in not exists
      $conforbooknow = mysqli_connect($mysql_server, $mysql_username, $mysql_password) or die('Failed to connect to database server!<br>'.mysqli_error($conforbooknow));
      mysqli_query($conforbooknow, "CREATE DATABASE IF NOT EXISTS $mysql_database");
   
 
//Create table in not exists 
      $conforbooknow =mysqli_connect($mysql_server, $mysql_username, $mysql_password, $mysql_database);

 mysqli_query($conforbooknow, "CREATE TABLE IF NOT EXISTS $mysql_table (ID int(9) NOT NULL auto_increment, `DATESTAMP` DATE, `TIME` VARCHAR(8) NOT NULL DEFAULT '00', `IP` VARCHAR(30) NOT NULL DEFAULT '00', `BROWSER` TINYTEXT, PRIMARY KEY (id))");


//create column names
      foreach($form_data as $name=>$value)
      {
         mysqli_query($conforbooknow, "ALTER TABLE $mysql_table ADD $name VARCHAR(50) NOT NULL DEFAULT '00'");
      }
      mysqli_query($conforbooknow, "INSERT INTO $mysql_table (`DATESTAMP`, `TIME`, `IP`, `BROWSER`)
                   VALUES ('".date("Y-m-d")."',
                   '".date("G:i:s")."',
                   '".$_SERVER['REMOTE_ADDR']."',
                   '".$_SERVER['HTTP_USER_AGENT']."')")or die('Failed to insert data into table!<br>'.mysqli_error($conforbooknow)); 
 

     $id = mysqli_insert_id($conforbooknow);


// add values to table
      foreach($form_data as $name=>$value)
      {

         mysqli_query($conforbooknow,"UPDATE $mysql_table SET $name =  '$value'  WHERE id = '$id'");

      }
      mysqli_close($conforbooknow);


}//Add new item

}
?>