25 lines
608 B
PHP
25 lines
608 B
PHP
<?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();
|
|
|
|
|
|
|
|
|