-
Notifications
You must be signed in to change notification settings - Fork 0
/
instructor_to_db.php
39 lines (35 loc) · 1.5 KB
/
instructor_to_db.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
33
34
35
36
37
38
39
<?php
include_once 'php_connection.php';
$nm = mysqli_real_escape_string($conn,$_POST['name']);
$add = mysqli_real_escape_string($conn,$_POST['address']);
$dob = mysqli_real_escape_string($conn,$_POST['dob']);
$sub = mysqli_real_escape_string($conn,$_POST['sub']);
$qu = mysqli_real_escape_string($conn,$_POST['Qu']);
$mob = mysqli_real_escape_string($conn,$_POST['mob']);
$exp = mysqli_real_escape_string($conn,$_POST['exp']);
$un = mysqli_real_escape_string($conn,$_POST['un']);
$pass = mysqli_real_escape_string($conn,$_POST['pass']);
if (empty($nm) || empty($add) ||empty($dob) ||empty($sub)||empty($qu)||empty($mob)||empty($exp)) {
header("Location: instructor.php?error=emptyfields");
exit();
}else{
$sql="insert into instructor (name,address,dob,expert,qualification,mob,experience,uname,pass) values (?,?,?,?,?,?,?,?,?)";
$stmt = mysqli_stmt_init($conn);
if(!mysqli_stmt_prepare($stmt,$sql)){
echo "SQL error";
}
else{
mysqli_stmt_bind_param($stmt,"sssssssss",$nm,$add,$dob,$sub,$qu,$mob,$exp,$un,$pass);
mysqli_stmt_execute($stmt);
/*$sql2="insert into marks (name,address,dob,expert,qualification,mob,experience) values (?,?,?,?,?,?,?)";
$stmt2 = mysqli_stmt_init($conn);
if(!mysqli_stmt_prepare($stmt2,$sql2)){
echo "SQL error";
}
else{
mysqli_stmt_bind_param($stmt,"sssssss",$nm,$add,$dob,$sub,$qu,$mob,$exp);
mysqli_stmt_execute($stmt);
}*/
}
header("Location: instructor.php?instructor_to_db=success");}
?>