<?php
// save_project.php
include 'db.php'; // make sure you have a db.php file with $conn = new mysqli(...);

// Check if form is submitted
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $project_name = $conn->real_escape_string($_POST['project_name']);
    $client_name  = $conn->real_escape_string($_POST['client_name']);
    $project_po   = (float) $_POST['project_po'];

    $sql = "INSERT INTO projects (project_name, client_name, project_po) 
            VALUES ('$project_name', '$client_name', $project_po)";

    if ($conn->query($sql) === TRUE) {
        // Redirect back to projects page after success
        header("Location: projects.php?success=1");
        exit;
    } else {
        echo "Error: " . $conn->error;
    }
}
?>