-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathform.php
More file actions
125 lines (106 loc) · 3.28 KB
/
form.php
File metadata and controls
125 lines (106 loc) · 3.28 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel='stylesheet' href="./css/style.css">
<title>Form</title>
</head>
<style>
@import url('https://fonts.googleapis.com/css2?family=Poppins&display=swap');
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Poppins', sans-serif;
}
.form-container {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
form {
width: 75vw;
max-width: 500px;
/* height: 400px; */
/* border: 1px solid black; */
padding: 20px;
border-radius: 10px;
box-shadow: 1px 1px 10px black;
/* background-color: hsla(203, 92%, 85%, 0.6); */
}
input[type="number"],
input[type="text"],
input[type="time"] {
width: 100%;
padding: 10px;
margin-bottom: 10px;
transition: all 300ms linear;
border: 1px solid grey;
border-radius: 5px;
}
input:focus {
background-color: hsl(203, 92%, 95%);
outline: none !important;
}
h2 {
text-align: center;
}
.time-container {
display: flex;
width: 100%;
column-gap: 20px;
}
.time-container div {
width: 100%;
}
.form-btn-container {
margin: 20px 0;
display: flex;
column-gap: 10px;
}
</style>
<body>
<?php
$period_id;
// we use 'GET' method here because we are reading the period data directly from the URL...
if (!isset($_GET['period'])) { // if the value of 'period' is NOT SET assign empty string to $period_id else assign it a received value(id)...
$period_id = "";
} else {
$period_id = $_GET['period'];
}
?>
<div class="form-container">
<form action="" method="post" class="form">
<h2>Manage Your Schedule</h2>
<label for="period">Period</label><br>
<input type="number" name="period" id="period" value=<?php echo $period_id ?>><br>
<label for="sname">Subject name</label><br>
<input type="text" name="subject_name" id="sname" required><br>
<label for="teacher">Teacher</label><br>
<input type="text" name="teacher" id="teacher" required><br>
<div class="time-container">
<div class="start-time-container">
<label for="s_time">Start Time</label><br>
<input type="time" name="s_time" id="s_time" required><br>
</div>
<div class="end-time-container">
<label for="e_time">End Time</label><br>
<input type="time" name="e_time" id="e_time" required><br>
</div>
</div>
<div class="form-btn-container">
<input type="submit" name="add" class="btn btn-add" value="Add" formaction="add.php">
<input type="submit" name="edit" class="btn btn-edit" value="Edit" formaction="edit.php">
<input type="submit" name="delete" class="btn btn-del" value="Delete" formaction="delete.php"
formnovalidate>
<!-- formnovalidate attribute added to bypass the form validation only for delete button... -->
</div>
</form>
</div>
</body>
</html>