-
Notifications
You must be signed in to change notification settings - Fork 0
/
report.php
32 lines (26 loc) · 895 Bytes
/
report.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
30
31
32
<?php
// Database credentials
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "database_name";
// Create a connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Get the crime information from the form
$crime_type = $_POST["crime-type"];
$description = $_POST["description"];
$time = $_POST["time"];
$location = $_POST["location"];
// Prepare a statement to insert the crime information into the database
$stmt = $conn->prepare("INSERT INTO crime_reports (crime_type, description, time, location) VALUES (?, ?, ?, ?)");
$stmt->bind_param("ssss", $crime_type, $description, $time, $location);
$stmt->execute();
// Display a success message
echo "Crime report submitted successfully.";
// Close the connection
$conn->close();
?>