<?php
/* include db connection file */
include("connection.php");

if(isset($_POST['submit'])){
    /* capture values from HTML form */
    $id = $_POST['ID'];
    $pass = $_POST['Pass'];
    $name = $_POST['Name'];
    $phonenum = $_POST['PhoneNum'];

    // Insert into user table
    $sql = "INSERT INTO admin (Admin_ID,Admin_Pass,Admin_Name,Admin_PhoneNum) VALUES ('$id','$pass','$name','$phonenum')";

    $result = mysqli_query($conn, $sql);

    if ($result) {
        echo "<script>alert('Sign In Successfull')</script>";
    } else {
        echo "<script>alert('Renter ID is already exist or error type entering')</script>";
    }
    echo "<script>window.location = 'newAdmin.php'</script>";
    exit();
    
    mysqli_close($conn); // Close connection
}
?>
