PHP 프로그래밍

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


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

2. 쪽지함 수정

페이지 정보

작성자 관리자 댓글 0건 조회 1,740회 작성일 21-05-22 17:44

본문

2. 쪽지함 수정

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


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/message.css">

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

</head>

<body> 

<header>

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

</header>  

<?php

if (!$userid )

{

echo("<script>

alert('로그인 후 이용해주세요!');

history.go(-1);

</script>

");

exit;

}

?>

<section>

<div id="message_box">

<h3 id="write_title">쪽지 보내기</h3>

<ul class="top_buttons">

<li><span><a href="message_box.php?mode=rv">수신 쪽지함 </a></span></li>

<li><span><a href="message_box.php?mode=send">송신 쪽지함</a></span></li>

</ul>

<form  name="message_form" method="post" action="message_insert.php?send_id=<?=$userid?>">

<div id="write_msg">

<ul>

<li>

<span class="col1">보내는 사람 : </span>

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

</li>

<li>

<span class="col1">수신 아이디 : </span>

<span class="col2"><input name="rv_id" type="text"></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>

</ul>

<button type="button" onclick="check_input()">보내기</button>

</div>    

</form>

</div> <!-- message_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/message.css">
<script type="text/javascript" src="./js/message_response.js"></script>
</head>
<body> 
<header>
<?php include "header.php";?>
</header>  
<section>

<div id="message_box">
<h3 id="write_title">답변 쪽지 보내기</h3>
<?php
$num  = $_GET["num"];

$con = mysqli_connect("localhost", "user1", "12345", "sample");

$sql = "select * from message where num=$num";
$result = mysqli_query($con, $sql);

$row = mysqli_fetch_array($result);
$send_id      = $row["send_id"];
$rv_id      = $row["rv_id"];
$subject    = $row["subject"];
$content    = $row["content"];

$subject = "RE: ".$subject; 

$content = "> ".$content; 
$content = str_replace("\n", "\n>", $content);
$content = "\n\n\n-----------------------------------------------\n".$content;

$result2 = mysqli_query($con, "select name from members where id='$send_id'");
$record = mysqli_fetch_array($result2);
$send_name    = $record["name"];
?>
<form  name="message_form" method="post" action="message_insert.php?send_id=<?=$userid?>">
<input type="hidden" name="rv_id" value="<?=$send_id?>">
<div id="write_msg">
<ul>
<li>
<span class="col1">보내는 사람 : </span>
<span class="col2"><?=$userid?></span>
</li>
<li>
<span class="col1">수신 아이디 : </span>
<span class="col2"><?=$send_name?>(<?=$send_id?>)</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>
</ul>
<button type="button" onclick="check_input()">보내기</button>
</div>
</form>
</div> <!-- message_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.