-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinsertstudent.php
More file actions
107 lines (102 loc) · 3.06 KB
/
Copy pathinsertstudent.php
File metadata and controls
107 lines (102 loc) · 3.06 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<?php
include("connection.php");
if($_SERVER["REQUEST_METHOD"]=== "POST"){
// cheaking name and lastName
$stName = $_POST["st_name"];
$stLastName = $_POST["st_lastName"];
$stTazkira = $_POST["tazkira_num"];
$imgUrl = $_POST["imgUrl"];
$class = $_POST["class"];
// Is into database any person with this information?
$result = $connection->query ("SELECT st_name, st_lastName,tazkira_num,imgUrl,class FROM student WHERE st_name='$stName' AND st_lastName='$stLastName' AND tazkira_num='$stTazkira' AND imgUrl='$imgUrl'AND class='$class'");
if($result->num_rows===0){
$connection->query("INSERT INTO student(st_name,st_lastName,tazkira_num,imgUrl,class) VALUES('$stName','$stLastName','$stTazkira','$imgUrl', '$class')");
}
else{
echo "<script> alert('SORRY, THE STUDENT ALREADY EXISTS')</script>";
}
}
?>
<style>
.parent1{
background-color: rgb(4, 73, 116);
height: 100vh;
width: 98vw;
position: relative;
}
.parent{
border: 1px solid grey;
margin: auto;
width: 50%;
position:absolute;
top:15%;
left:25%;
align-items:center;
justify-content:center;
display:flex;
border-radius: 10px;
box-shadow: 3px 6px 10px grey;
background-color: white;
}
input{
padding: 10px;
margin: 10px ;
font-family: cursive;
border: none;
width:50%;
box-shadow: 1px 3px 4px grey;
border-radius: 5px;
margin-left: 25%;
}
input:focus{
outline: 0;
}
h1{
text-align: center;
font-family: cursive;
color:white;
margin-top:20px;
}
button{
background-color: rgb(4, 73, 116);
padding:12px;
border: none;
color: white;
border-radius: 4px;
display: block;
margin: 6px;
margin-left: 15%;
} .a{
background-color: rgb(4, 73, 116);
padding:10px;
border: none;
color: white;
border-radius: 4px;
display: block;
margin-left:50%;
}
</style>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div class=" parent1">
<h1>ADD NEW STUDENT</h1>
<div class="parent">
<form action="<?php echo $_SERVER["PHP_SELF"]?>" method="Post">
<input type="text" name="st_name" placeholder="Name">
<input type="text" name="st_lastName" placeholder="LastName">
<input type="number" name="tazkira_num" placeholder="TazkiraNumber">
<input type="file" name="imgUrl" placeholder="ImgUrl">
<input type="text " name="class" placeholder="class">
<div style="margin:6px auto; display:flex; text-decoration:none; color:white"> <button >Save</button>
<button class="a"> <a style="margin:2px auto; display:flex; text-decoration:none; color:white" href="./searchstudent.php">Home</a></button></div>
</form>
</div>
</div>
</body>
</html>