답변 3개 / 댓글 1개
채택된 답변
+20 포인트
예를 들어 다음과 같이 해 볼 수 있지 않을까 생각합니다.
write.skin.php
Copy
<form method="post" name="fwrite" action="./write_update.php" enctype="multipart/form-data" onsubmit="return fwrite_submit(this);">
<!-- 기존 폼 내용 유지 -->
<!-- 여분의 필드 추가 -->
<div class="extra-field-section">
<label for="wr_1_coffee">커피 종류:</label>
<input type="text" name="wr_1_coffee" id="wr_1_coffee" placeholder="예: 아메리카노, 라떼 등">
<label for="wr_1_quantity">수량:</label>
<input type="number" name="wr_1_quantity" id="wr_1_quantity" placeholder="주문 수량">
<!-- 추가 필드가 있다면 여기에 계속 추가 -->
</div>
<input type="submit" value="글쓰기" class="btn_submit">
</form>
write_update.php 또는 write_update.skin.php
Copy
<?php
// 기존 코드 내용 유지
// 여분의 필드 저장
$wr_1_coffee = isset($_POST['wr_1_coffee']) ? $_POST['wr_1_coffee'] : '';
$wr_1_quantity = isset($_POST['wr_1_quantity']) ? (int)$_POST['wr_1_quantity'] : 0;
// 추가 필드가 있다면 여기에 계속 추가
$wr_1_coffee = $eb->escape_string($wr_1_coffee);
// 데이터베이스에 삽입
$write->insert('g5_write_게시판아이디', $wr_id, $wr_content, $wr_subject, /* 추가 필드가 있다면 여기에 계속 추가 */, $wr_1_coffee, $wr_1_quantity, /* 추가 필드가 있다면 여기에 계속 추가 */);
// 기존 코드 계속...
?>
답변을 작성하려면 로그인이 필요합니다.