-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathteacher_signup.html
More file actions
94 lines (82 loc) · 4.06 KB
/
teacher_signup.html
File metadata and controls
94 lines (82 loc) · 4.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Teacher Signup</title>
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="bg-gray-100 min-h-screen flex items-center justify-center">
<div class="bg-white p-8 rounded-lg shadow-md w-full max-w-md">
<h2 class="text-2xl font-bold mb-6 text-center">Teacher Signup</h2>
<form id="signupForm" class="space-y-4">
<div>
<label for="fullName" class="block text-sm font-medium text-gray-700">Email</label>
<input type="email" id="fullName" name="fullName" required
class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm">
</div>
<div>
<label for="firstName" class="block text-sm font-medium text-gray-700">First Name</label>
<input type="text" id="firstName" name="firstName" required
class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm">
</div>
<div>
<label for="idNumber" class="block text-sm font-medium text-gray-700">ID Number</label>
<input type="text" id="idNumber" name="idNumber" required
class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm">
</div>
<div>
<label for="universityName" class="block text-sm font-medium text-gray-700">University Name</label>
<input type="text" id="universityName" name="universityName" required
class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm">
</div>
<div>
<label for="password" class="block text-sm font-medium text-gray-700">Password</label>
<input type="password" id="password" name="password" required
class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm">
</div>
<div>
<button type="submit" class="w-full bg-blue-600 text-white py-2 px-4 rounded-md hover:bg-blue-700">
Sign Up
</button>
</div>
<div class="text-center">
<p class="text-sm text-gray-600">Already have an account?
<a href="teacher_login.html" class="text-blue-600 hover:underline">Login</a>
</p>
</div>
</form>
</div>
<script>
document.getElementById('signupForm').addEventListener('submit', async (e) => {
e.preventDefault();
const formData = {
fullName: document.getElementById('fullName').value.trim(),
firstName: document.getElementById('firstName').value.trim(),
idNumber: document.getElementById('idNumber').value.trim(),
universityName: document.getElementById('universityName').value.trim(),
password: document.getElementById('password').value
};
try {
const response = await fetch('teacher_signup.php', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(formData)
});
const result = await response.json();
if (result.success) {
alert('Registration successful!');
window.location.href = 'teacher_login.html';
} else {
alert('Error: ' + (result.error || 'Registration failed'));
}
} catch (error) {
console.error('Error:', error);
alert('An error occurred. Please try again.');
}
});
</script>
</body>
</html>