-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocess.php
More file actions
36 lines (29 loc) · 875 Bytes
/
process.php
File metadata and controls
36 lines (29 loc) · 875 Bytes
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
33
34
35
<?php
// Database connection details
$servername = "localhost"; // For local server
$username = "root"; // Default username for XAMPP/WAMP
$password = "k@r@nKP9696"; // Default password for XAMPP/WAMP
$dbname = "codebook"; // Replace with your actual database name
// Create connection
$conn = new mysqli($id, $name, $email, $password);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Get form data
$name = $_POST['name'];
$email = $_POST['email'];
// Insert data into database
$sql = "INSERT INTO register (name, email) VALUES ('$name', '$email')";
if ($conn->query($sql) === TRUE) {
echo "Data submitted successfully!";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
// Close connection
$conn->close();
?>
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
?>