Current File : /home/obabain/public_html/abc/AddDepartmentRole.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    <%@ include file="Connection.jsp" %>
    <%
    Statement st=con.createStatement();
    %>
   
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<form>
<%@include file="master.jsp" %>
<div class="content">
<div class="row">
<div class="col-md-9"  style="width:50%;background-color:white;">
<div class="panel panel-default" >
       <div class="panel-heading main-color-bg">
        <h3 class="panel-title">Add Department role</h3>
              </div>
             </div>
<table class="table" style="width:50%;">
<!-- 
<tr>
<td>
ID</td>
<td>
<input type="text" name="rid" class="form-control">
</td>
</tr>
 -->
<tr>
<td>
Role</td>
<td>
<input type="text" name="rname" class="form-control">
</td>
</tr>
<tr>
<td>
Department</td><td>
            <select  name="dept" class="form-control">
            <option>-select-</option>
             <%
            ResultSet rd=st.executeQuery("select * from ip_department");
            while(rd.next())
            {
            	
            %>
            <option value="<%=rd.getString("id")%>"><%=rd.getString("dept_name")%></option>
            <%} %>
            </select>
            </td>
            </tr>
           
            
</table>
<div class="modal-footer" id="contact_submit">
<a class="btn btn-default" href="AddDepartmentRole.jsp">Reset</a>
 <input type="submit" value="Save" class="btn btn-info" style="background:#204b58" onclick="confirmpass()">
 </div>
</div>
<%
try{
String dname=request.getParameter("dept");
String role=request.getParameter("rname");
if(dname.length()!=0 || dname!=null)
{
int i=st.executeUpdate("insert into ip_dept_roles values(0,'"+dname+"','"+role+"',0,"+loginid+",NOW())");
response.sendRedirect("UserAdmin.jsp");
}
}
catch(Exception el){}

%>
</div>
</div>
<%@include file="footer.jsp" %>
</form>
</body>
</html>