<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {

    $host = "localhost"; 
    $username = "root";
    $password = "";
    $dbname = "WSAS";

    
    $con = mysqli_connect($host, $username, $password, $dbname);

    if (!$con) {
        die("Connection failed!" . mysqli_connect_error());
    } 

    
    $fee_name = mysqli_real_escape_string($con, $_POST['fee_name']);
    $fee_amount = (float)$_POST['fee_amount'];
    $subject_fee = mysqli_real_escape_string($con, $_POST['subject_fee']);


    $sql = "INSERT INTO `adminfee` (`fee_name`, `fee_amount`, `subject_fee`)
            VALUES ('$fee_name', '$fee_amount', '$subject_fee')";

    $rs = mysqli_query($con, $sql);

    if ($rs) {
            header("Location: ../adminpanel/adminfees.php");
            exit;
        }

    mysqli_close($con);
} 

?>