PHP 프로그래밍

본문 바로가기
사이트 내 전체검색


PHP 프로그래밍
PHP 프로그래밍

3. 게시판 수정

페이지 정보

작성자 관리자 댓글 0건 조회 1,075회 작성일 21-05-22 18:04

본문

3. 게시판 수정

입력폼에서 자바스크립트를 이용하여 필수 입력사항을 검사하는 처리를 추가합니다. 


1. 글쓰기 폼 페이지


<!DOCTYPE html>

<html>

<head> 

<meta charset="utf-8">

<title>게시판 > 글쓰기</title>

<link rel="stylesheet" type="text/css" href="./css/common.css">

<link rel="stylesheet" type="text/css" href="./css/board.css">

<script type="text/javascript" src="./js/board.js"></script>

</head>

<body> 

<header>

    <?php include "header.php";?>

</header>  

<section>

    <div id="board_box">

    <h3 id="board_title">

    게시판 > 글 쓰기

</h3>

    <form  name="board_form" method="post" action="board_insert.php" enctype="multipart/form-data">

    <ul id="board_form">

<li>

<span class="col1">이름 : </span>

<span class="col2"><?=$username?></span>

</li>

    <li>

    <span class="col1">제목 : </span>

    <span class="col2"><input name="subject" type="text"></span>

    </li>    

    <li id="text_area">

    <span class="col1">내용 : </span>

    <span class="col2">

    <textarea name="content"></textarea>

    </span>

    </li>

    <li>

        <span class="col1"> 첨부 파일</span>

        <span class="col2"><input type="file" name="upfile"></span>

    </li>

        </ul>

    <ul class="buttons">

<li><button type="button" onclick="check_input()">완료</button></li>

<li><button type="button" onclick="location.href='board_list.php'">목록</button></li>

</ul>

    </form>

</div> <!-- board_box -->

</section> 

<footer>

    <?php include "footer.php";?>

</footer>

</body>

</html>



2. 글 수정 폼 페이지

<!DOCTYPE html>
<html>
<head> 
<meta charset="utf-8">
<title>게시판 > 글수정</title>
<link rel="stylesheet" type="text/css" href="./css/common.css">
<link rel="stylesheet" type="text/css" href="./css/board.css">
<script type="text/javascript" src="./js/board.js"></script>
</head>
<body> 
<header>
    <?php include "header.php";?>
</header>  
<section>
    <div id="board_box">
    <h3 id="board_title">
    게시판 > 글 쓰기
</h3>
<?php
$num  = $_GET["num"];
$page = $_GET["page"];
$con = mysqli_connect("localhost", "user1", "12345", "sample");
$sql = "select * from board where num=$num";
$result = mysqli_query($con, $sql);
$row = mysqli_fetch_array($result);
$name       = $row["name"];
$subject    = $row["subject"];
$content    = $row["content"];
$file_name  = $row["file_name"];
?>
    <form  name="board_form" method="post" action="board_modify.php?num=<?=$num?>&page=<?=$page?>" enctype="multipart/form-data">
    <ul id="board_form">
<li>
<span class="col1">이름 : </span>
<span class="col2"><?=$name?></span>
</li>
    <li>
    <span class="col1">제목 : </span>
    <span class="col2"><input name="subject" type="text" value="<?=$subject?>"></span>
    </li>    
    <li id="text_area">
    <span class="col1">내용 : </span>
    <span class="col2">
    <textarea name="content"><?=$content?></textarea>
    </span>
    </li>
    <li>
        <span class="col1"> 첨부 파일 : </span>
        <span class="col2"><?=$file_name?></span>
    </li>
        </ul>
    <ul class="buttons">
<li><button type="button" onclick="check_input()">수정하기</button></li>
<li><button type="button" onclick="location.href='board_list.php'">목록</button></li>
</ul>
    </form>
</div> <!-- board_box -->
</section> 
<footer>
    <?php include "footer.php";?>
</footer>
</body>
</html>



댓글목록

등록된 댓글이 없습니다.


개인정보취급방침 서비스이용약관 모바일 버전으로 보기 상단으로

TEL. 063-469-4551 FAX. 063-469-4560 전북 군산시 대학로 558
군산대학교 컴퓨터정보공학과

Copyright © www.leelab.co.kr. All rights reserved.