ssocha/p10/post.php

25 lines
608 B
PHP
Raw Normal View History

2024-10-10 12:05:20 +00:00
<?php
$con = mysqli_connect("localhost", "root", "", "baza1");
$lastname = $_POST['Lastname'];
$firstname = $_POST['Firstname'];
$mail = $_POST['mail'];
$sub = $_POST['sub'];
$path = $_POST['path'];
$query = "INSERT INTO persons (LastName, FirstName, Email, Subject, Path) VALUES ('$lastname', '$firstname', '$mail', '$sub', '$path')";
if (mysqli_query($con, $query)) {
$response = array('status' => 'success');
} else {
$response = array('status' => 'error', 'message' => mysqli_error($con)); // Provide error details
}
echo json_encode($response);
$con->close();