forked from kirannegi0149/Employee-Management
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathedit-record.jsp
More file actions
154 lines (136 loc) · 3.17 KB
/
edit-record.jsp
File metadata and controls
154 lines (136 loc) · 3.17 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<html>
<head>
<style>
/* General Body Styling */
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #dde3df;
color: #333;
}
/* Container Styling */
.container {
width: 100%;
max-width: 800px;
margin: 40px auto;
padding: 20px;
background-color: white;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
border-radius: 8px;
}
/* Form Styling */
form {
display: flex;
flex-direction: column;
gap: 20px;
}
.form-group {
display: flex;
flex-direction: column;
}
.form-group label {
font-weight: bold;
margin-bottom: 5px;
}
.form-group input {
padding: 12px;
border: 1px solid #ddd;
border-radius: 4px;
font-size: 1.1em;
width: 100%;
}
.form-group input[readonly] {
background-color: #f9f9f9;
}
button {
padding: 12px 20px;
background-color: #007BFF;
color: white;
border: none;
font-size: 1.1em;
cursor: pointer;
border-radius: 4px;
transition: background-color 0.3s ease;
}
button:hover {
background-color: #0056b3;
}
/* Navbar Styling */
nav {
background-color: #007BFF;
padding: 10px 20px;
color: white;
text-align: center;
}
nav a {
color: white;
text-decoration: none;
margin: 0 15px;
}
nav a:hover {
text-decoration: underline;
}
</style>
</head>
<body onload="makeActive('edit')">
<%
String eid = request.getParameter("eid");
Class.forName("com.mysql.cj.jdbc.Driver");
Connection cn = DriverManager.getConnection("jdbc:mysql://localhost:3306/jsp10", "root", "mysqlkiran011");
PreparedStatement ps = cn.prepareStatement("select * from employeeinfo where eid=?");
ps.setString(1, eid);
ResultSet rst = ps.executeQuery();
if (rst.next()) {
%>
<%@ include file="navbar.jsp"%>
<div class="container">
<form action="update-record.jsp" method="post">
<div class="form-group">
<label>Enter employee id</label> <input type="number"
value="<%=rst.getString(1)%>" name="eid" readonly="readonly">
</div>
<div class="form-group">
<label>Edit first name</label> <input type="text"
value="<%=rst.getString(2)%>" name="firstname" required>
</div>
<div class="form-group">
<label>Edit last name</label> <input type="text"
value="<%=rst.getString(3)%>" name="lastname" required>
</div>
<div class="form-group">
<label>Edit phone number</label> <input type="tel"
value="<%=rst.getString(4)%>" name="phone" required>
</div>
<div class="form-group">
<label>Edit department</label> <input type="text"
value="<%=rst.getString(5)%>" name="department" required>
</div>
<div class="form-group">
<label>Edit email id</label> <input type="emailid"
value="<%=rst.getString(6)%>" name="emailid" required>
</div>
<div class="form-group">
<label>Edit salary</label> <input type="number"
value="<%=rst.getString(7)%>" name="salary" required>
</div>
<div class="form-group">
<button type="submit">Update Record</button>
</div>
</form>
</div>
<%
} else {
%>
<div class="container">
<p style="color: red;">
Employee record with ID
<%=eid%>
does not exist.
</p>
</div>
<%
}
%>
</body>
</html>