PHP code not connecting HTML to MYsql database

hey there im new to php ……so i wanted to make a program in which my html form inputs are stored in the data base I followed a youtube tutorial to do this this is the link to it enter link description hereand heres the code i have written for the php file `<?php

$firstname = $_POST ['firstname'] ;
$email = $_POST ['email'];
$admin = $_POST ['admin'];
$school = $_POST ['school'];
$gender = $_POST ['gender'] ;

//DATABASE CONECTION
$conn = new mysqli('localhost', 'root', '', 'register');
if ($conn-> connect_error){
die ('connection error    :  ' . $conn-> connect_error);
}else{
$stmt = $conn->prepare("INSERT INTO register(firstname, email, admin, gender)
values(?, ?, ?, ?, ?)");
$stmt-> bind_param("ssiss", $firstname, $email, $admin, $gender);
$stmt-> execute();
echo"Registration succesfull";
$stmt-> close();
$conn-> close();
}`

and here is my database
enter image description here
and my html program
enter image description here
but when i run it the html form runs fine but the php program is just displayed on the screen without any output pls help me thanks