-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsubmit.php
More file actions
51 lines (43 loc) · 2.56 KB
/
submit.php
File metadata and controls
51 lines (43 loc) · 2.56 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
46
47
48
49
50
51
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "studentinfo";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$fName = $conn->real_escape_string($_POST['fName']);
$lName = $conn->real_escape_string($_POST['lName']);
$myPhone = $conn->real_escape_string($_POST['myPhone']);
$gender = $conn->real_escape_string($_POST['gender']);
$status = $conn->real_escape_string($_POST['status']);
$dob = $conn->real_escape_string($_POST['dob']);
$orign = $conn->real_escape_string($_POST['orign']);
$fatherName = $conn->real_escape_string($_POST['fatherName']);
$fatherPhone = $conn->real_escape_string($_POST['fatherPhone']);
$fatherEmail = $conn->real_escape_string($_POST['fatherEmail']);
$motherName = $conn->real_escape_string($_POST['motherName']);
$motherPhone = $conn->real_escape_string($_POST['motherPhone']);
$motherEmail = $conn->real_escape_string($_POST['motherEmail']);
$address1 = $conn->real_escape_string($_POST['address1']);
$address2 = $conn->real_escape_string($_POST['address2']);
$address3 = $conn->real_escape_string($_POST['address3']);
$pinNo = $conn->real_escape_string($_POST['pinNo']);
$state = $conn->real_escape_string($_POST['state']);
$country = $conn->real_escape_string($_POST['country']);
$schoolcountry = $conn->real_escape_string($_POST['schoolcountry']);
$school = $conn->real_escape_string($_POST['school']);
$high = $conn->real_escape_string($_POST['high']);
$schoolName = $conn->real_escape_string($_POST['schoolName']);
$college = $conn->real_escape_string($_POST['college']);
$collegeName = $conn->real_escape_string($_POST['collegeName']);
$degree = $conn->real_escape_string($_POST['degree']);
$sql = "INSERT INTO student (first_name, last_name, phone, gender, status, dob, place_of_birth, father_name, father_phone, father_email, mother_name, mother_phone, mother_email, address1, address2, address3, pin, state, country, school_country, school, highest_qualification, school_name, college, college_name, degree) VALUES ('$fName', '$lName', '$myPhone', '$gender', '$status', '$dob', '$orign', '$fatherName', '$fatherPhone', '$fatherEmail', '$motherName', '$motherPhone', '$motherEmail', '$address1', '$address2', '$address3', '$pinNo', '$state', '$country', '$schoolcountry', '$school', '$high', '$schoolName', '$college', '$collegeName', '$degree')";
if ($conn->query($sql) === TRUE) {
echo json_encode(['message' => 'Data successfully inserted']);
} else {
echo json_encode(['error' => 'Error: ' . $conn->error]);
}
$conn->close();
?>