본문 바로가기
개발/html,Thymeleaf

php/html 회원가입 member.php

by 카앙구운 2015. 10. 16.
728x90
반응형

php 회원가입 폼



member.php



<html>

<head>

<meta charset="utf-8">


<title>회원가입</title>

</head>

<script>

function fn_save1(){

var f=eval(document.frm);

if(f.id.value==""){

alert("아이디를 입력해주세요");

history.back();

return;

}

if(f.pwd.value==""||f.pwdCheck.value==""){

alert("비밀번호를 입력해주세요");

history.back();

return;

}


if(f.pwd.value!=f.pwdCheck.value){

alert("비밀번호와 비밀번호 확인이 맞지 않습니다.");

f.pwd.clear();

history.back();

return;

}else if(f.pwd.value==f.pwdCheck.value){

f.submit();

}

}

</script>


<body>


<?

include "../include/login.php";

include "../include/toptitle.php";

include "../include/topmenu.php";

?>



<div style="position:relative; height:50%; width:100%;">

<table border="0" cellpadding="0" cellspacing="1" bgcolor="#000000" width="80%">

<tr>

<td><font color="#ffffff" size="5"><b>회원가입</b></font></td>

</tr>

<tr>

<td bgcolor="#bcbcbc" colspan="2"></td>

</tr>

</table>

<table border="0" cellpadding="1" cellspacing="1" bgcolor="#ffffff" width="80%" > 

<form name="frm" method="post" action="member_save.php">

<tr>

<td><br></td>

</tr>

<tr>

<br>

<td bgcolor="#ffffff" align="center">아이디</td>

<td><input type="text" name="id">

<input type="button" value="중복체크"></td>

</tr>

<tr><td><br></td></tr>


<tr>

<td bgcolor="#ffffff" align="center">

비밀번호</td><td><input type="password" name="pwd">&nbsp &nbsp 

비밀번호 확인&nbsp &nbsp <input type="password" name="pwdCheck"></td>

</tr>

<tr><td><br></td></tr>

<tr>

<td bgcolor="#bcbcbc" colspan="2"></td>

</tr>

<tr><td><br></td></tr>

<tr>

<td bgcolor="#ffffff" align="center">닉네임</td>

<td><input type="text" name="nick">

</tr>

<tr><td><br></td></tr>

<tr>

<td bgcolor="#ffffff" align="center">이메일</td>

<td><input type="text" name="email1">

&nbsp &nbsp@&nbsp &nbsp

<select name="email2">

<option value="naver.com">naver.com</option>

<option value="daum.net">daum.net</option>

<option value="hotmail.com">hotmail.com</option>

</select>

</tr>

<tr><td><br></td></tr>

<tr><td bgcolor="#bcbcbc" colspan="2"></td></tr>


<tr>

<td align="right" colspan="2">

<input type="button" value="회원가입" onClick="fn_save1()"></td>

</tr>

<form>

</table>


</div>


</body>


</html>

--------------------------------------------------------------------------------------------------------
member_save.php 회원가입 php코드


<meta charset="utf-8">
<?
include "../include/dbcon.php";
include "../include/script.php";

$id=trim($_POST[id]);
$pwd=trim($_POST[pwd]);
$nick=trim($_POST[nick]);
$email=trim($_POST[email1]."@".$_POST[email2]);

if($id==""||$pwd==""){
error_msg("다시 시도해주세요");
}

$sql="insert into member(id,pwd,nick,rdate,email) values('$id','$pwd','$nick',now(),'$email')";
$ret=mysql_query($sql);

if(!$ret){
error_msg("다시 시도해주세요");
exit;
}else{
echo"<script>alert('성공');
location.href='../main.html';
</script>";
}
?>


728x90
반응형

댓글