<?php
// Database connection
include('connection.php');



// Check if POST variables are set
if (isset($_POST['account_name']) && isset($_POST['profile_id'])) {
    $account_name = $conn->real_escape_string($_POST['account_name']);
    $profile_id = $conn->real_escape_string($_POST['profile_id']);
    
    // Insert the object name and user ID into the database
    $sql = "INSERT INTO rr_410_accounts (profile_id, account_name) VALUES ('$profile_id', '$account_name')";

    
    if ($conn->query($sql) === TRUE) {
        echo "New object created successfully";
    } else {
        echo "Error: " . $sql . "<br>" . $conn->error;
    }
    
    $conn->close();
} else {
    echo "Invalid input";
}
?>
