<?php
   include('connection.php');
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    // Retrieve form data
    $password = $_POST["pass"];
    // var_dump($password);
    // die();
    $plateform = $_POST["plateform"];
    $url = $_POST["url"];
    $username = $_POST["name"];
  
    $type = $_POST["type"];
    $datetme =date('d/m/y h:i:sa');


    // Insert $row=mysqli_fetch_array($res)data into a table (change table and field names as needed)
    $sql = "INSERT INTO hr_accounts (plateform, url, name, pass, type,datetime) VALUES ('$plateform', '$url', '$username', '$password', '$type','$datetme')";
    $res=mysqli_query($conn,$sql);
    
    if ($res==1) {

        // echo "Data inserted successfully.";
        header("Location:hr_accounts.php"); 

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

    $conn->close();
} else {
    echo "Invalid request method. Please submit the form.";
}
?>
