<?php
// Database connection details
$servername = "localhost"; // Change this to your server
$username = "root";        // Change this to your MySQL username
$password = "";            // Change this to your MySQL password
$dbname = "your_database"; // Change this to your database name

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

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

// Check if form was submitted
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    // Get the Plan Name from the form
    $plan_name = mysqli_real_escape_string($conn, $_POST['plan_name']);
    
    // Insert query to add the plan to the database
    $sql = "INSERT INTO ib_plans (plan_name) VALUES ('$plan_name')";
    
    // Check if the query was successful
    if ($conn->query($sql) === TRUE) {
        echo "New IB Plan added successfully!";
    } else {
        echo "Error: " . $sql . "<br>" . $conn->error;
    }
    
    // Close the connection
    $conn->close();
} else {
    echo "Invalid request.";
}
?>
