-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
85 lines (75 loc) · 2.69 KB
/
index.php
File metadata and controls
85 lines (75 loc) · 2.69 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
<?php
include_once 'config.php';
include_once 'function.php';
$errors = array();
if (isset($_POST['submit'])) {
$employeeObj = new employeeData($conn);
$employeeObj->insertData();
if (empty($name)) {
$errors[] = "Name is required*";
}
if (empty($phone)) {
$errors[] = "Phone is required*";
}
if (empty($email)) {
$errors[] = "Email is required*";
}
if (empty($password)) {
$errors[] = "Password is required*";
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Registration form</title>
<style>
.error {
color: red;
}
</style>
</head>
<body>
<?php include_once 'header.php'; ?>
<div class="container">
<h1 style="color: black; text-align:center; font-weight:800">Registration form </h1>
<form action="index.php" method="POST">
<div class="mb-3">
<label class="form-label">Name</label>
<input type="text" class="form-control" id="name" name="name">
<?php if (!empty($errors) && in_array("Name is required*", $errors)) { ?>
<span class="error">Name is required*</span>
<?php } ?>
<br>
</div>
<div class="mb-3">
<label class="form-label">Phone</label>
<input type="text" class="form-control" id="phone" name="phone">
<?php if (!empty($errors) && in_array("Phone is required*", $errors)) { ?>
<span class="error">Phone is required*</span>
<?php } ?>
<br>
</div>
<div class="mb-3">
<label class="form-label">Email address</label>
<input type="email" class="form-control" id="email" name="email">
<?php if (!empty($errors) && in_array("Email is required*", $errors)) { ?>
<span class="error">Email is required*</span>
<?php } ?>
<br>
</div>
<div class="mb-3">
<label class="form-label">Password</label>
<input type="password" class="form-control" id="password" name="password">
<?php if (!empty($errors) && in_array("Password is required*", $errors)) { ?>
<span class="error">Password is required*</span>
<?php } ?>
<br>
</div>
<button type="submit" class="btn btn-primary" name="submit" value="submit">Submit</button>
<a href="login.php" class="btn btn-secondary">Login</a> <!-- Replaced button with anchor tag -->
</form>
</div>
<?php include 'footer.php'; ?>
</body>
</html>