-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathform.php
144 lines (127 loc) · 5.74 KB
/
form.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
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<?php
include "config.php";
include "navbar.php";
session_start();
if (!isset($_SESSION['username'])) {
header("Location: login.php");
}
?>
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="UTF-8">
<title>Pendaftaran Siswa Baru</title>
<link rel="stylesheet" href="css/form.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<div class="container">
<div class="title">Pendaftaran Siswa Baru</div>
<div class="content">
<form name="formPendaftaran" action="tambah.php" method="post" onsubmit="return validateForm()">
<div class="user-details">
<div class="input-box">
<span class="details">NIS</span>
<input name="nis" type="number" placeholder="Masukan NIS" required>
</div>
<div class="input-box">
<span class="details">Nama Lengkap</span>
<input name="nama" type="text" placeholder="Masukan Nama Lengkap" required>
</div>
<div class="input-box">
<span class="details">Alamat lengkap</span>
<input name="alamat" type="text" placeholder="Masukkan Alamat Lengkap" required>
</div>
<div class="input-box">
<span class="details">Kota</span>
<input name="kota" type="text" placeholder="Masukan Kota" required>
</div>
<div class="input-box">
<span class="details">Kode Pos</span>
<input name="kode_pos" type="number" placeholder="Kode Pos" required>
</div>
<div class="input-box">
<span class="details">Umur</span>
<input name="umur" type="number" placeholder="Masukan Umur" required>
</div>
<div class="input-box">
<span class="details">Agama</span>
<select id="agama" name="agama">
<option id="option-list" value="">Pilih Agama</option>
<option value="Islam">Islam</option>
<option value="Kristen">Kristen</option>
<option value="Hindu">Hindu</option>
<option value="Budha">Budha</option>
</select>
</div>
<div class="input-box">
<span class="details">Golongan Darah</span>
<input name="golonganDarah" type="text" placeholder="Masukkan Golongan Darah" required>
</div>
<div class="input-box">
<span class="details">Nama Ayah Kandung</span>
<input name="ayah" type="text" placeholder="Masukkan Nama Ayah Kandung" required>
</div>
<div class="input-box">
<span class="details">Nama Ibu Kandung</span>
<input name="ibu" type="text" placeholder="Masukkan Nama Ibu Kandung" required>
</div>
</div>
<div class="gender-details">
<input type="radio" name="gender" value="Laki - Laki" id="dot-1">
<input type="radio" name="gender" value="Perempuan" id="dot-2">
<span class="gender-title">Jenis Kelamin</span>
<div class="category">
<label for="dot-1">
<span class="dot one"></span>
<span class="gender">Laki - Laki</span>
</label>
</div>
<div class="category">
<label for="dot-2">
<span class="dot two"></span>
<span class="gender">Perempuan</span>
</label>
</div>
</div>
<div class="button">
<input type="submit" name="daftar" value="Daftar">
</div>
</form>
</div>
</div>
<script>
function validateForm() {
if (document.forms["formPendaftaran"]["agama"].value == "") {
alert("Pilih Agama");
document.forms["formPendaftaran"]["agama"].focus();
return false;
}
function validationForm() {
var validasiHuruf = /^[a-zA-Z ]+$/;
var nama = document.getElementsByName("nama");
if (nama.value.match(validasiHuruf)) {
alert("Nama Anda adalah " + nama.value);
} else {
alert("Masukkan nama Anda!\nFormat wajib huruf!");
nama.value = "";
nama.focus();
return false;
}
}
function validationForm() {
var validasiHuruf = /^[a-zA-Z ]+$/;
var ayah = document.getElementsByName("ayah");
if (ayah.value.match(validasiHuruf)) {
alert("Nama Anda adalah " + nama.ayah);
} else {
alert("Masukkan nama Anda!\nFormat wajib huruf!");
ayah.value = "";
ayah.focus();
return false;
}
}
}
</script>
</body>
</html>