write 에서 if 문 사용 알려주세요 ㅜㅜ
본문
접속 주소는
https://artstore.iptime.org:1009/bbs/write.php?bo_table=cm_contact
이곳입니다.
원하는 구현 방식은
서비스 선택에 4가지가 있는데 각각 선택시 아래 하나씩 나오길 원합니다 ㅜㅜ 마음대로 작동하지 않네요
소스는
<div class="form-group row">
<label class="col-sm-2 col-form-label"><?php echo $board['bo_6_subj'] ?></label>
<div class="col-sm-10">
<?php
$item_list = explode(',', $board['bo_6']);
for ($i=0; $i<count($item_list); $i++) {
$option_item = trim($item_list[$i]);
?>
<input type="radio" name="wr_6" value="<?php echo $option_item ?>" <?php echo ($write['wr_6'] == $option_item) ? "checked" : "";?> required> <?php echo $option_item ?>
<?php } ?>
</div>
</div>
<!-- 테스팅 -->
<?php if($write['wr_6'] == '입주청소' ) {?>입주청소<?php } ?>
이 곳에 아래 bo_7이 포함된걸 넣고싶습니다.
<!-- 테스팅 -->
<!-- 입주 -->
<div class="form-group row">
<label class="col-sm-2 col-form-label"><?php echo $board['bo_7_subj'] ?></label>
<div class="col-sm-10">
<?php
$item_list = explode(',', $board['bo_7']);
for ($i=0; $i<count($item_list); $i++) {
$option_item = trim($item_list[$i]);
?>
<input type="radio" name="wr_7" value="<?php echo $option_item ?>" <?php echo ($write['wr_7'] == $option_item) ? "checked" : "";?> required> <?php echo $option_item ?>
<?php } ?>
</div>
</div>
<!-- 맞춤 -->
<div class="form-group row">
<label class="col-sm-2 col-form-label"><?php echo $board['bo_8_subj'] ?></label>
<div class="col-sm-10">
<?php
$item_list = explode(',', $board['bo_8']);
for ($i=0; $i<count($item_list); $i++) {
$option_item = trim($item_list[$i]);
?>
<input type="radio" name="wr_8" value="<?php echo $option_item ?>" <?php echo ($write['wr_8'] == $option_item) ? "checked" : "";?> required> <?php echo $option_item ?>
<?php } ?>
</div>
</div>
<!-- 소독 -->
<div class="form-group row">
<label class="col-sm-2 col-form-label"><?php echo $board['bo_9_subj'] ?></label>
<div class="col-sm-10">
<?php
$item_list = explode(',', $board['bo_9']);
for ($i=0; $i<count($item_list); $i++) {
$option_item = trim($item_list[$i]);
?>
<input type="radio" name="wr_9" value="<?php echo $option_item ?>" <?php echo ($write['wr_9'] == $option_item) ? "checked" : "";?> required> <?php echo $option_item ?>
<?php } ?>
</div>
</div>
<!-- 시공 -->
<div class="form-group row">
<label class="col-sm-2 col-form-label"><?php echo $board['bo_10_subj'] ?></label>
<div class="col-sm-10">
<?php
$item_list = explode(',', $board['bo_10']);
for ($i=0; $i<count($item_list); $i++) {
$option_item = trim($item_list[$i]);
?>
<input type="radio" name="wr_10" value="<?php echo $option_item ?>" <?php echo ($write['wr_10'] == $option_item) ? "checked" : "";?> required> <?php echo $option_item ?>
<?php } ?>
</div>
</div>
답변 2
php말고 스크립트로 구현하시는게 좋겠습니다.
https://www.tutorialrepublic.com/codelab.php?topic=faq&file=jquery-show-hide-div-using-radio-button
참조하시고 각 색상부분에 원하시는 항목을 넣어 보시면서 공부하시면 되겠습니다.
서비스 클릭하니 아래 block되네요 축하드려용~!ㅔ