<?php
include('db_connection.php');
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $term_name = $_POST['term_name'];

    $stmt = $conn->prepare("INSERT INTO terms (term_name) VALUES (?)");
    $stmt->bind_param("s", $term_name);

    if ($stmt->execute()) {
        echo "New term added successfully!";
    } else {
        echo "Error: " . $stmt->error;
    }

    $stmt->close();
    $conn->close();
}
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Add Term</title>
    <link rel="stylesheet" href="#"> <!-- Add your CSS file -->
     <style type="text/css">
        body {
    font-family: Arial, sans-serif;
}

h2 {
    color: #333;
}

form {
    margin: 20px;
}

label {
    display: block;
    margin-top: 10px;
}

input, select, textarea {
    width: 100%;
    padding: 10px;
    margin-top: 5px;
    box-sizing: border-box;
}

input[type="submit"] {
    background-color: #4CAF50;
    color: white;
    border: none;
    cursor: pointer;
    margin-top: 20px;
}

input[type="submit"]:hover {
    background-color: #45a049;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

table, th, td {
    border: 1px solid #ddd;
}

th, td {
    padding: 10px;
    text-align: left;
}

th {
    background-color: #f2f2f2;
}

    </style>
</head>
<body>
    <h2>Add Term</h2>
    <form method="post" action="">
        <label for="term_name">Term Name:</label>
        <input type="text" id="term_name" name="term_name" required>
        <input type="submit" value="Add Term">
    </form>
</body>
</html>
