-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathemployee_data_entry.php
More file actions
108 lines (98 loc) · 4.39 KB
/
employee_data_entry.php
File metadata and controls
108 lines (98 loc) · 4.39 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
<!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">
<title>Add Employee Data</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
<style>
body {
background-color: #f0f0f0;
}
.container {
max-width: 800px;
margin: 20px auto;
}
.employee-card {
border: 1px solid #ccc;
border-radius: 10px;
padding: 20px;
margin-bottom: 20px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
.employee-card h2 {
text-align: center;
margin-bottom: 20px;
}
.btn-primary {
background-color: #007bff;
border: none;
border-radius: 5px;
}
</style>
</head>
<body>
<?php
include_once("navbar.php");
?>
<div class="container">
<div class="employee-card">
<h2>Add Employee Data</h2>
<form id="addEmployeeForm" method="POST">
<div class="form-group">
<label for="employeeName">Employee Name</label>
<input type="text" class="form-control" name="employeeName" id="employeeName">
</div>
<div class="form-group">
<label for="employeeContact">Employee Contact</label>
<input type="text" class="form-control" name="employeeContact" id="employeeContact">
</div>
<div class="form-group">
<label for="employeeAddress">Employee Address</label>
<input type="text" class="form-control" name="employeeAddress" id="employeeAddress">
</div>
<div class="form-group">
<label for="employeeSalary">Employee Salary</label>
<input type="text" class="form-control" name="employeeSalary" id="employeeSalary">
</div>
<div class="form-group">
<label for="employeeCompany">Employee Company</label>
<input type="text" class="form-control" name="employeeCompany" id="employeeCompany">
</div>
<button type="submit" class="btn btn-primary"><i class="fas fa-plus"></i> Add Employee Data</button>
</form>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.bundle.min.js"></script>
<script>
$(document).ready(function() {
$('#addEmployeeForm').on('submit', function(event) {
event.preventDefault();
var formData = $(this).serialize();
// Perform an AJAX request to add the employee data
$.ajax({
url: 'process_add_employee.php',
type: 'POST',
data: formData,
dataType: 'json',
success: function(response) {
// Check if the addition was successful
if (response.success) {
alert('Employee data added successfully.');
window.location.href = 'employee.php';
} else {
alert('Failed to add employee data.');
}
},
error: function() {
alert('An error occurred while adding employee data.');
}
});
});
});
</script>
</body>
</html>