<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
    <%@ page import="java.sql.*" %>
    <%@ page import="java.sql.Connection" %>
    <%@ page import="java.sql.DriverManager" %>
    <%@ page import="java.sql.PreparedStatement" %>
    <%@ page import="java.sql.ResultSet" %>
    
    <% request.setCharacterEncoding("EUC-KR"); %>
    
    <% 
    String id = request.getParameter("id");
    String password = request.getParameter("password");
    String name = request.getParameter("name");
    String year = request.getParameter("year");
    String month = request.getParameter("month");
    String day = request.getParameter("day");
    String zipcode = request.getParameter("zipcode");
    String zipcode2 = request.getParameter("zipcode2");
    String address = request.getParameter("address");
    String anotheraddress = request.getParameter("anotheraddress");
    String email = request.getParameter("email");
    String domain = request.getParameter("domain");
    String job = request.getParameter("job");
    
    String birth = year + "-" + month + "-" + day;
    String zip = zipcode + "-" + zipcode2;
    String addadd = address + " " + anotheraddress;
    String addemail = email + "@" + domain;
    
    String str = "";
   
	try{
	
		Class.forName("oracle.jdbc.driver.OracleDriver");
		Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@168.126.146.45:1521:orcl","20162513","970709");
		PreparedStatement pstmt = conn.prepareStatement("insert into member_20190514(id,password,name,yyyymmdd,zipcode,address,email,job) values(?,?,?,?,?,?,?,?)");
		pstmt.setString(1, id);
    	pstmt.setString(2, password);
    	pstmt.setString(3, name);
    	pstmt.setString(4, birth);
    	pstmt.setString(5, zip);
    	pstmt.setString(6, addadd);
    	pstmt.setString(7, addemail);
    	pstmt.setString(8, job);
	 
		pstmt.executeUpdate();
		pstmt.close();
		conn.close();
	
		str="member_20190514 테이블에 새로운 레코드를 추가했습니다.";
	}catch(Exception e){
		e.printStackTrace();
		str="member_20190514 테이블에 새로운 레코드 추가에 실패했습니다.";
	}
    %>
    
    <!DOCTYPE html>
<html>
<head>
<meta charset="EUC-KR">
<title>레코드 추가</title>
</head>
<body style = " text-align : center; ">
    
    <h2>회원가입정보</h2>
    <hr>
    <table border="1" style = "margin: 0 auto;">
       <tr>
       <th bgcolor="#FFFF88">아 이 디</th><td><%=id%></td></tr>
       <tr>
       <th bgcolor="#FFFF88">패스워드</th><td><%=password%></td></tr>
       <tr>
       <th bgcolor="#FFFF88">이&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;름</th><td><%=name %></td></tr>
       <tr>
       <th bgcolor="#FFFF88">생년월일</th><td><%=year %>년 <%=month %>월 <%=day %>일</td> </tr>
       <tr>
       <th bgcolor="#FFFF88">우편번호</th><td><%=zipcode %>-<%=zipcode2 %></td></tr>
       <tr>
       <th bgcolor="#FFFF88">주&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;소</th><td><%=address %>&nbsp;<%=anotheraddress %></td></tr>
       <tr>
       <th bgcolor="#FFFF88">이 메 일</th><td><%=email %>@<%=domain %></td></tr>
       <tr>
       <th bgcolor="#FFFF88">직&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;업</th><td><%=job %></td></tr>
       </table>
       
       <A href="http://localhost:8080/woo/main.jsp" >메인페이지로</p>
       
       
       </body>
</html>