본문 바로가기

프로그래밍/게시판 만들기

회원가입 페이지 join.php, join_action.php

 

프론트엔드(?)

join.php

<!DOCTYPE html>
<html lang="ko" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title>회원가입</title>
    <style type="text/css">
      h1,h2{
        text-align:center;
      }
      table{
        width: auto;
        margin: auto;
      }
    </style>
  </head>
  <body>
    <h1>Welecome</h1>
    <h2>JOIN</h2>
      <form action="join_action.php" method="post">
        <table border="1">
          <tr>
            <td>ID<input type="text" name="id"></td>
          </tr>
          <tr>
            <td>pw<input type="password" name="pw"> </td>
          </tr>
          <tr>
            <td> <input type="submit"> </td>
          </tr>
        </table>
      </form>
  </body>
</html>

 

백엔드(?)

join_action.php

<?php
$id=$_POST['id'];
$pw=$_POST['pw'];
$con = mysqli_connect('localhost','root','----','---') or die("fail");
$query="insert into acc values(NULL,'$id','$pw')";
$result=mysqli_query($con,$query);
if($result){?>
  <script type="text/javascript">
    alert("JOIN success!!");
    location.href="index.php";
  </script>
  <?php
}
else {
  echo "Fail";
}
 ?>

'프로그래밍 > 게시판 만들기' 카테고리의 다른 글

로그아웃  (0) 2019.11.16
글 작성 write.php write_action.php  (0) 2019.11.16
글 보기 view.php  (0) 2019.11.16
로그인 페이지 login.php login_action.php  (0) 2019.11.16
메인화면 index.php(수정 중)  (0) 2019.11.15