-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsubmit.php
More file actions
45 lines (39 loc) · 1.46 KB
/
Copy pathsubmit.php
File metadata and controls
45 lines (39 loc) · 1.46 KB
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
36
37
38
39
40
41
42
43
44
45
<?php
if ($_SERVER["REQUEST_METHOD"] === "POST") {
// Database configuration
$db_host = "localhost"; // Change to your database host if needed
$db_user = "root"; // Change to your database username
$db_pass = ""; // Change to your database password
$db_name = "admission_form"; // Change to your database name
// Create a database connection
$conn = new mysqli($db_host, $db_user, $db_pass, $db_name);
// Check the connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Process the form data
$name = $_POST["name"];
$email = $_POST["email"];
$dob = $_POST["dob"];
$gender = $_POST["gender"];
$phone = $_POST["phone"];
$aadhar = $_POST["aadhar"];
$entranceMarks = $_POST["entranceMarks"];
$degree = $_POST["degree"];
$course = $_POST["course"];
$address = $_POST["address"];
// Insert the data into the database
$sql = "INSERT INTO applicants (name, email, dob, gender, phone, aadhar, entranceMarks, degree, course, address)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
$stmt = $conn->prepare($sql);
$stmt->bind_param("ssssssdsss", $name, $email, $dob, $gender, $phone, $aadhar, $entranceMarks, $degree, $course, $address);
if ($stmt->execute()) {
echo "Data inserted successfully!";
} else {
echo "Error: " . $conn->error;
}
// Close the database connection
$stmt->close();
$conn->close();
}
?>