<%@ 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" %>
<%@ page session="true" %>

<% request.setCharacterEncoding("utf-8"); %>
<%
String id = (String)session.getAttribute("id");

%>    
<html>
 <link rel="stylesheet" href="../../visual.css">
<head>
<meta charset="UTF-8">
<title>정보수정</title>

</head>
<body>
<script>

	function checkValue(){
		if(!document.userInfo.id.value){
			alert("아이디를 입력해주세요.");
			return false;
		}else if(!document.userInfo.password.value){
			alert("비밀번호를 입력해주세요.");
			return false;
		}else if(document.userInfo.password.value != document.userInfo.passwordRE.value){
			alert("비밀번호와 비밀번호 재입력 값이 일치하지 않습니다.");
			return false;
		}else if(!document.userInfo.name.value){
			alert("이름을 입력해주세요.");
			return false;
		}else if(!document.userInfo.year.value){
			alert("년도를 입력해주세요.");
			return false;
		}else if(!document.userInfo.phone_number.value){
			alert("핸드폰 번호를 입력해주세요.");
			return false;
		}else if(!document.userInfo.email1.value){
			alert("이메일을 입력해주세요.");
			return false;
		}else if(document.userInfo.email.options[document.userInfo.email.selectedIndex].value == '0'){
			alert("메일을 선택해 주세요.");
			return false;
		}else if(document.userInfo.email.options[document.userInfo.email.selectedIndex].value == '9'){
			if(!document.userInfo.email2.value){ //만약 밸류가 9인경우
				alert("메일을 입력해 주세요.");
				return false;
			}
		} 
	}
</script>


<table>
<tr>
<td>
	<h2 style="text-align:center; font-size:50px"> 정보수정  </h2>
	<form method="post" name="userInfo" action="editPro.jsp" onsubmit="return checkValue()">
		
		아이디 <br>
		<input class="box" type="text" name="id" placeHolder="아이디" autocomplete=off value=<%=id %> disabled><br>
		비밀번호 <br>
		<input class="box" type="password" name="password" placeHolder="비밀번호" autocomplete=off><br>
		비밀번호 확인<br>
		<input class="box" type="password" name="passwordRE" placeHolder="비밀번호 재입력" autocomplete=off><br>
		이름<br>
		<input class="box" type="text" name="name" placeHolder="이름"autocomplete=off><br>
		생년월일<br>
		<input style="width: 180px; height: 50px; padding : 10px;" type="number" min="1800" max="2100" name="year" placeHolder="년(4자)"autocomplete=off>년  
		<select style="width: 100px; height: 50px;" name="month">		
			<option value="1">1</option>
			<option value="2">2</option>
			<option value="3">3</option>
			<option value="4">4</option>
			<option value="5">5</option>
			<option value="6">6</option>
			<option value="7">7</option>
			<option value="8">8</option>
			<option value="9">9</option>
			<option value="10">10</option>
			<option value="11">11</option>
			<option value="12">12</option>
		</select>월  
		<select style="width: 100px; height: 50px;" name="day">
			<option value="1">1</option>
			<option value="2">2</option>
			<option value="3">3</option>
			<option value="4">4</option>
			<option value="5">5</option>
			<option value="6">6</option>
			<option value="7">7</option>
			<option value="8">8</option>
			<option value="9">9</option>
			<option value="10">10</option>
			<option value="11">11</option>
			<option value="12">12</option>
			<option value="13">13</option>
			<option value="14">14</option>
			<option value="15">15</option>
			<option value="16">16</option>
			<option value="17">17</option>
			<option value="18">18</option>
			<option value="19">19</option>
			<option value="20">20</option>
			<option value="21">21</option>
			<option value="22">22</option>
			<option value="23">23</option>
			<option value="24">24</option>
			<option value="25">25</option>
			<option value="26">26</option>
			<option value="27">27</option>
			<option value="28">28</option>
			<option value="29">29</option>
			<option value="30">30</option>
			<option value="31">31</option>
		</select>일<br>
		휴대전화<br>
		<input class="box" type="text" name="phone_number" placeHolder="전화번호 입력"autocomplete=off><br>
		이메일<br>

<input style="width: 173px; height: 50px; padding : 10px;" type="text" name="email1" placeHolder="이메일"autocomplete=off>   @
<input type="text" name="email2" id="" value="" placeHolder="직접입력" disabled style="width: 143px; height: 50px; padding : 10px;">
<select name="email" onchange="email_change()" style="width: 100px; height: 50px;">
    <option value="0" >선택하세요</option>
    <option value="9">직접입력</option>
    <option value="naver.com">naver.com</option>
    <option value="nate.com">nate.com</option> 
   </select><br><br>
		<input style="width: 450px; height: 50px;" type="submit" value="입력완료">
	</form>
	</td>
	</tr>
	</table>
</body>



<script>
function email_change(){
if(document.userInfo.email.options[document.userInfo.email.selectedIndex].value == '0'){
 document.userInfo.email2.disabled = true;
 document.userInfo.email2.value = "";
}
if(document.userInfo.email.options[document.userInfo.email.selectedIndex].value == '9'){
 document.userInfo.email2.disabled = false;
 document.userInfo.email2.value = "";
 document.userInfo.email2.focus();

} else{
 document.userInfo.email2.disabled = true;
 document.userInfo.email2.value = document.join.email.options[document.join.email.selectedIndex].value;
}
}
</script>




</html>