<?php
include('connection.php');
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    // Get the new platform data from the form
    $source = $_POST["name"];

    // Validate and sanitize the input (You can add more validation as needed)
    $source = htmlspecialchars($source);
    $currentDate = date('Y-m-d');
    

    // Insert the new platform data into the database (Replace with your SQL query)
    $sql = "INSERT INTO add_source (name,datetime) VALUES ('$source','$currentDate')";

    if ($conn->query($sql) === TRUE) {

        // echo "New platform added successfully!";
        header("Location: add_source.php?success = New Source added successfully!!!");

    } else {
        echo "Error: " . $sql . "<br>" . $conn->error;
    }

    // Close the database connection
    $conn->close();
}
?>