폼태그 영향 문제 (풀소스)
본문
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<!-- Favicons
================================================== -->
<link rel="shortcut icon" href="img/favicon.ico" type="image/x-icon">
<link rel="apple-touch-icon" href="img/apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="72x72" href="img/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="114x114" href="img/apple-touch-icon-114x114.png">
<!-- Bootstrap -->
<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="fonts/font-awesome/css/font-awesome.css">
<!-- Stylesheet
================================================== -->
<link rel="stylesheet" type="text/css" href="css/style.css">
<link rel="stylesheet" type="text/css" href="css/prettyPhoto.css">
<link href='http://fonts.googleapis.com/css?family=Lato:400,700,900,300' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,700,800,600,300' rel='stylesheet' type='text/css'>
<script type="text/javascript" src="js/modernizr.custom.js"></script>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<!-- Navigation
==========================================-->
<nav id="menu" class="navbar navbar-default navbar-fixed-top">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li><a href="#home" class="page-scroll">Home</a></li>
<li><a href="#about-section" class="page-scroll">About</a></li>
<li><a href="#services-section" class="page-scroll">Services</a></li>
<li><a href="#works-section" class="page-scroll">Merit</a></li>
<li><a href="#team-section" class="page-scroll">Team</a></li>
<li><a href="#contact-section" class="page-scroll">Contact</a></li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>
<!-- Header -->
<!-- About Section -->
<!-- Services Section -->
<!-- Contact Section -->
<div id="contact-section">
<div class="container">
<div class="section-title center">
<h2>Contact Us</h2>
<hr>
</div>
<div class="col-md-8">
<h4>회원가입</h4>
<form action='./join_post.php' name='member' method='post'>
<div class="row">
<input type='hidden' name='id' value="test">
<div class="col-md-6">
<div class="form-group">
<input type="text" name="user_id" id="name" class="form-control" placeholder="회원아이디" required="required">
<p class="help-block text-danger"></p>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<input type="text" name="name" id="name" class="form-control" placeholder="이름" required="required">
<p class="help-block text-danger"></p>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<input type="text" name="nick_name" id="name" class="form-control" placeholder="닉네임" required="required">
<p class="help-block text-danger"></p>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<input type="text" name="birth" id="name" class="form-control" placeholder="생년월일" required="required">
<p class="help-block text-danger"></p>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<input type="text" name="tel" id="name" class="form-control" placeholder="연락처" required="required">
<p class="help-block text-danger"></p>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<input type="text" name="email" id="name" class="form-control" placeholder="이메일" required="required">
<p class="help-block text-danger"></p>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<input type="password" name="" id="name" class="form-control" placeholder="비밀번호" required="required">
<p class="help-block text-danger"></p>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<input type="text" name="addr_1" id="name" class="form-control" placeholder="주소" required="required">
<p class="help-block text-danger"></p>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<input type="email" name="addr_2" id="email" class="form-control" placeholder="상세주소" required="required">
<p class="help-block text-danger"></p>
</div>
</div>
</div>
<div id="success"></div>
<button type="submit" class="btn btn-default">Send Message</button>
</form>
</div>
</div>
</div>
<div id="social-section">
<div class="container">
<div class="social">
<ul>
<li><a href="#"><i class="fa fa-facebook"></i></a></li>
<li><a href="#"><i class="fa fa-twitter"></i></a></li>
<li><a href="#"><i class="fa fa-dribbble"></i></a></li>
<li><a href="#"><i class="fa fa-github"></i></a></li>
<li><a href="#"><i class="fa fa-instagram"></i></a></li>
<li><a href="#"><i class="fa fa-linkedin"></i></a></li>
</ul>
</div>
</div>
</div>
<div id="footer">
<div class="container">
<p>Copyright © Optics. Designed by <a href="http://www.netsolution.kr" rel="nofollow">NetSolution Co.,Ltd</a></p>
</div>
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.1.11.1.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script type="text/javascript" src="js/bootstrap.js"></script>
<script type="text/javascript" src="js/SmoothScroll.js"></script>
<script type="text/javascript" src="js/jquery.prettyPhoto.js"></script>
<script type="text/javascript" src="js/jquery.isotope.js"></script>
<script type="text/javascript" src="js/jqBootstrapValidation.js"></script>
<script type="text/javascript" src="js/contact_me.js"></script>
<!-- Javascripts
================================================== -->
<script type="text/javascript" src="js/main.js"></script>
</body>
</html>
join.php
<?header("content-type:text/html; charset=UTF-8");
include("../lib/db_connect.php");
$connect=dbconn();
$id=$_POST[id];
$user_id=$_POST[user_id];
$name=$_POST[name];
$nick_name=$_POST[nick_name];
$birth=$_POST[birth];
$sex=$_POST[sex];
$tel=$_POST[tel];
$email=$_POST[email];
$pws=$_POST[pw];
$addr_1=$_POST[addr_1];
$addr_2=$_POST[addr_2];
if(!$user_id)Error("회원 아이디를 입력하세요.");
if(substr($user_id, "12"))Error("회원아이디는 12자리 까지 입력하세요.");
if(preg_match("/[^a-z 0-9]/", $user_id))Error("아이디는 영문자와 소문자만 가능합니다.");
if(!$name)Error("이름 입력하세요.");
if(strlen($name)<6 or strlen($name)>15)Error("이름은 2자에서 5섯자 까지만 허용합니다."); //한글은 1자당 3byte
if(!$birth)Error("생년월일을 입력하세요.");
if(strlen($birth)<8 or strlen($birth)>8)Error("생년월일은 8자만 입력하세요.");
if(!$sex)Error("성별을 입력하세요.");
if(!$tel)Error("번호 입력하세요.");
if(strlen($tel)<8 or strlen($tel)>15)Error("연락처는 최소 8자부터 최대 15자리 까지입니다.");
if(!$email)Error("이메일을 입력하세요.");
if($email && !preg_match("(^[_0-9a-zA-Z-]+(\.[_0-9a-zA-Z-]+)*@[0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*$)", $email)){
Error("이메일주소가 잘못되었습니다.");
}
if(!$pws)Error("비번을 입력하세요.");
if(!$addr_1)Error("주소를 입력하세요.");
$regdate=date("YmdHis", time()); //날짜, 시간
$ip=getenv("REMOTE_ADDR"); //ip
$pw=md5($pws); //비밀번호 암호화
//쿼리 전송
$query="insert into member(id, user_id, name, nick_name, birth, sex, tel, email, pw, addr_1, addr_2, regdate, ip)
values('$id', '$user_id', '$name', '$nick_name', '$birth', '$sex', '$tel', '$email', '$pw', '$addr_1', '$addr_2','$regdate', '$ip')";
mysql_query("set names utf8", $connect);
mysql_query($query, $connect);
mysql_close; //끝내기
?>
<script>
window.alert('회원가입이 완료 되었습니다.');
location.href='../index.html'
</script>
join_post.php
값이 post자체로 넘어가지를 않습니다. join에서 액션값을 join_post로 주어도 전혀 불르질 않습니다.
js가 id 또는 클래스 상위단에서 방해하는 건지요? 어찌해야할까요?
답변 3
제가 테스트 해보니 값은 잘 넘어가는것 같아요.
form에 action 을 join.php로 잘 설정했는지 확인하시고.
그리고 패스워드는 네임값이 없는것 같고 모두 id가 name으로 중복되어 있는데, id값은 중복되지 않게 수정해주셔야 할꺼 같아요.
스크립트들이 풀패스로 잡혀있지 않아서 충돌을 확인은 못했는데, 스크립트 하나씩 지워보시면서 테스트 해보시면 될꺼 같아요.
분명히 <form action='./join_post.php' name='member' method='post'> 액션값을 join_post로 하였는데
contact_me 가 호출되네요....id는 전부 다른명의로 바꿧거든요.....
xhr 호출이면 ajax로 폼이 전송되는거 같아요
<script type="text/javascript" src="js/contact_me.js"></script>
를지우고 해보세요.