<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ 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("utf-8");%>

<%
String id=request.getParameter("id");
String pw=request.getParameter("pw");
String repw=request.getParameter("repw");
String name=request.getParameter("name");
String bYear=request.getParameter("bYear");
String bMonth=request.getParameter("bMonth");
String bDay=request.getParameter("bDay");
String gender=request.getParameter("gender");
String email=request.getParameter("email");
String phone=request.getParameter("phone");

String str="";

try{
	Class.forName("oracle.jdbc.driver.OracleDriver");
	Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@168.126.146.45:1521:orcl","20182264","981218");
	PreparedStatement pstmt=conn.prepareStatement("insert into member_2(id,pw,repw,name,bYear,bMonth,bDay,gender,email,phone) values(?,?,?,?,?,?,?,?,?,?)");
	
	pstmt.setString(1,id);
	pstmt.setString(2,pw);
	pstmt.setString(3,repw);
	pstmt.setString(4,name);
	pstmt.setString(5,bYear);
	pstmt.setString(6,bMonth);
	pstmt.setString(7,bDay);
	pstmt.setString(8,gender);
	pstmt.setString(9,email);
	pstmt.setString(10,phone);
	
	pstmt.executeUpdate();
	pstmt.close();
	conn.close();
	
	str="회원가입되었습니다.";
}catch(Exception e){
	e.printStackTrace();
	str="회원가입되지 못했습니다.";
}
%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>회원가입 inputPro</title>
</head>
<body>
<h2>회원가입</h2>
<%=str %><br>

<a href="http://localhost:8080/FinalTest2/LoginForm.jsp">로그인 하러 가기</a><br>
<a href="http://localhost:8080/FinalTest2/List.jsp">리스트 확인하기</a>


</body>
</html>