Replit php mysqli

Hello,

I would like to know what i can do to fix mysqli in php web server in replit.com because when i submit the form i have an error.

Thank you

<?php
$servername = "";
$username = "";
$password = "";
$dbname = "";

if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $conn = new mysqli_connect($servername, $username, $password, $dbname);

    if ($conn->connect_error) {
        die("Connection failed: " . $conn->connect_error);
    }

    $first_name = $_POST['first_name'];
    $last_name = $_POST['last_name'];

    $sql = "INSERT INTO employees (first_name, last_name) VALUES ('$first_name', '$last_name')";

    if ($conn->query($sql) === TRUE) {
        echo "Record added successfully";
    } else {
        echo "Error: " . $sql . "<br>" . $conn->error;
    }

    $conn->close();
}
?>

Question:
Hello,

I am trying to connect a html form with mysql with php but i have an error with mysqli.

Repl link:

<!DOCTYPE html>
<html lang="en">
<head>
      <meta charset="UTF-8">
      <title>PHP Form</title>
      <style>
            body {
                  font-family: Arial, sans-serif;
                  background-color: #f4f4f4;
                  margin: 0;
                  padding: 0;
            }

            .container {
                  max-width: 400px;
                  margin: 50px auto;
                  background-color: #fff;
                  padding: 20px;
                  border-radius: 8px;
                  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            }

            .form-group {
                  margin-bottom: 20px;
            }

            label {
                  display: block;
                  font-weight: bold;
                  margin-bottom: 5px;
            }

            input[type="text"],
            input[type="email"],
            input[type="submit"] {
                  width: 100%;
                  padding: 10px;
                  border-radius: 4px;
                  border: 1px solid #ccc;
                  box-sizing: border-box;
            }

            input[type="submit"] {
                  background-color: #007bff;
                  color: #fff;
                  cursor: pointer;
            }

            input[type="submit"]:hover {
                  background-color: #0056b3;
            }
      </style>
</head>
<body>

<?php
$servername = "127.0.0.1";
$username = "root";
$password = "protected";
$database = "internal";

// Create connection
$conn = new mysqli($servername, $username, $password, $database);

// Check connection
if ($conn->connect_error) {
      die("Connection failed: " . $conn->connect_error);
}

if ($_SERVER["REQUEST_METHOD"] == "POST") {
      $name = $conn->real_escape_string($_POST['name']);
      $email = $conn->real_escape_string($_POST['email']);

      $sql = "INSERT INTO intern (name, email) VALUES ('$name', '$email')";
      if ($conn->query($sql) === TRUE) {
            echo "New record created successfully";
      } else {
            echo "Error: " . $sql . "<br>" . $conn->error;
      }

      $conn->close();
}
?>

<div class="container">
      <form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" method="post">
            <div class="form-group">
                  <label for="name">Name:</label>
                  <input type="text" name="name" id="name" required>
            </div>

            <div class="form-group">
                  <label for="email">Email:</label>
                  <input type="email" name="email" id="email" required>
            </div>

            <input type="submit" value="Submit">
      </form>
</div>

</body>
</html>