-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprocess_proforma.php
29 lines (24 loc) · 965 Bytes
/
process_proforma.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
require('php/database.php');
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if (!empty($_POST['title']) && !empty($_POST['category']) && !empty($_POST['date'])) {
$title = $_POST['title'];
$category = $_POST['category'];
$date = $_POST['date'];
// Escape inputs to prevent SQL injection
$title = mysqli_real_escape_string($conn, $title);
$category = mysqli_real_escape_string($conn, $category);
$date = mysqli_real_escape_string($conn, $date);
// SQL query to insert data
$sql = "INSERT INTO proforma (TITLE, CATEGORY, Date_of_Upload) VALUES ('$title', '$category', '$date')";
if ($conn->query($sql) === TRUE) {
echo "Proforma added successfully.";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
} else {
echo "One or more required fields are missing.";
}
}
$conn->close();
?>