Secect 박스를 Radio 형태로 변경하는 법 아시나요?

Secect 박스를 Radio 형태로 변경하는 법 아시나요?

QA

Secect 박스를 Radio 형태로 변경하는 법 아시나요?

본문

https://sir.kr/g5_skin/40207?sfl=wr_subject%7C%7Cwr_content&stx=%EA%B0%84%ED%8E%B8%EC%83%81%EB%8B%B4

 

그누보드 간편상담 최신글 형식의 스킨을 사용중입니다.

 

243931675_1613564032.3902.jpg

 

현재 '지역' 선택창이 Select 형식으로 되어 있는데 이것을 내용을 수정해 Radio 체크 형태로 변경하고 싶습니다.

<li class="f_b">
                            <label for="bsubject" style="float: left;">
                                <img src="<?php echo $latest_skin_url;?>/img/la_2.png">
                            </label>

 

                            <select name="region" class="is2">
                                <option value="">성별</option>
                                <option value="남성">남성</option>
                                <option value="여성">여성</option>
                            </select>

 

                            <select name="married" class="is2">
                                <option value="">결혼</option>
                                <option value="초혼">초혼</option>
                                <option value="재혼">재혼</option>
                            </select>
                        </li>

 

----------------------------------------

단순히

<label> <input type="radio" name="region"> 남성</label>
<label> <input type="radio" name="region"> 여성</label>

이렇게 변경하면 되는건지....

 

완전 초보라서 문의드립니다.

 

--------ajax.request_save.php 내용-------------------

<?php
include_once($_SERVER['DOCUMENT_ROOT'] .'/common.php');

if(!$bo_table)
    die(json_encode(array('error'=>'위젯설정에서 보드아이디를 설정해주세요.')));

if(!$is_member && $is_login)
    die(json_encode(array('error'=>'회원가입후 이용해주세요.')));

$wr_1 = trim($_POST['name']);    //이름
$wr_2 = trim($_POST['region']);    //성별
$wr_3 = trim($_POST['married']); //결혼
$wr_4 = trim($_POST['tel1'].'-'.$_POST['tel2'].'-'.$_POST['tel3']);    //연락처

//$bo_table = "online";
$write_table = $g5['write_prefix'] . $bo_table;

$wr_num = get_next_num($write_table);
$wr_reply = "";
$html = 'html1';

if ($member['mb_id']) {
    $mb_id = $member['mb_id'];
    $wr_name = addslashes(clean_xss_tags($board['bo_use_name'] ? $member['mb_name'] : $member['mb_nick']));
    $wr_password = $member['mb_password'];
} else {
    $mb_id = '';
    // 비회원의 경우 이름이 누락되는 경우가 있음
    $wr_name = clean_xss_tags(trim($wr_1));
    if (!$wr_name)
        alert('이름은 필히 입력하셔야 합니다.');
    $wr_password = get_encrypt_string($wr_3);
}

//분류
if($board['bo_use_category']){
    $ca_name = $_POST['ca_name'];
}

$wr_subject = $wr_1.'님 상담신청';
$wr_content = $wr_1.'님 상담신청입니다.<br>';
$wr_content .= '이름 : '.$wr_1.'<br>';
$wr_content .= '성별 : '.$wr_2.'<br>';
$wr_content .= '결혼 : '.$wr_3.'<br>';
$wr_content .= '연락처 : '.$wr_4;

$sql = " insert into $write_table
            set wr_num = '$wr_num',
                wr_reply = '$wr_reply',
                wr_comment = 0,
                ca_name = '$ca_name',
                wr_option = '$html,$secret,$mail',
                wr_subject = '$wr_subject',
                wr_content = '$wr_content',
                wr_link1 = '$wr_link1',
                wr_link2 = '$wr_link2',
                wr_link1_hit = 0,
                wr_link2_hit = 0,
                wr_hit = 0,
                wr_good = 0,
                wr_nogood = 0,
                mb_id = '$mb_id',
                wr_password = '$wr_password',
                wr_name = '$wr_name',
                wr_email = '$wr_email',
                wr_datetime = '".G5_TIME_YMDHIS."',
                wr_last = '".G5_TIME_YMDHIS."',
                wr_ip = '{$_SERVER['REMOTE_ADDR']}',
                wr_1 = '$wr_1',
                wr_2 = '$wr_2',
                wr_3 = '$wr_3',
                wr_4 = '$wr_4',
                wr_5 = '$wr_5',
                wr_6 = '$wr_6',
                wr_7 = '$wr_7',
                wr_8 = '$wr_8',
                wr_9 = '$wr_9',
                wr_10 = '$wr_10' ";

if(sql_query($sql)){

    $wr_id = sql_insert_id();

    // 부모 아이디에 UPDATE
    sql_query(" update $write_table set wr_parent = '$wr_id' where wr_id = '$wr_id' ");

    // 새글 INSERT
    sql_query(" insert into {$g5['board_new_table']} ( bo_table, wr_id, wr_parent, bn_datetime, mb_id ) values ( '{$bo_table}', '{$wr_id}', '{$wr_id}', '".G5_TIME_YMDHIS."', '{$member['mb_id']}' ) ");

    // 게시글 1 증가
    sql_query("update {$g5['board_table']} set bo_count_write = bo_count_write + 1 where bo_table = '{$bo_table}'");

    delete_cache_latest($bo_table);

    die(json_encode(array('error'=>'')));

}else{
    die(json_encode(array('error'=>'접수에 문제가 있습니다. 관리자에게 문의하세요.')));
}
?>

 

 

--------------latest.skin.php--------------------

<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가

global $g5, $config, $member, $is_member;

// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
add_stylesheet('<link rel="stylesheet" href="'.$latest_skin_url.'/style.css">', 0);

$row = sql_fetch("select count(*) as cnt from {$g5['member_table']} ");
$total_count = $row['cnt'];

//간편상담 높이
$options['footer_h'] = (isset($options['footer_h']) && $options['footer_h']) ? $options['footer_h'] : '155';

//배경이미지 & 색상
$options['bgcolor'] = (isset($options['bgcolor']) && $options['bgcolor']) ? $options['bgcolor'] : '#161d2e';
$options['background'] = (isset($options['background']) && $options['background']) ? $options['background'] : '';
//$options['background'] = (isset($options['background']) && $options['background']) ? $options['background'] : $latest_skin_url.'/img/foo_bo_bg.png';

// 타이틀
$is_title = (isset($options['title_chk']) && $options['title_chk']) ? true : false;
$title = (isset($options['title']) && $options['title']) ? $options['title'] : $config['cf_title'].'에 고객님들이 관심을 보여주셨습니다.';
$title_fs = (isset($options['title_fs']) && $options['title_fs']) ? $options['title_fs'] : '30';
$title_fc = (isset($options['title_fc']) && $options['title_fc']) ? $options['title_fc'] : 'black';

//버튼명 & 색상
$options['btn'] = (isset($options['btn']) && $options['btn']) ? $options['btn'] : '간편상담';
$options['btnc'] = (isset($options['btnc']) && $options['btnc']) ? $options['btnc'] : 'black';

//회원,비회원구분
$is_login = (isset($options['is_login']) && $options['is_login']) ? true : false;

//분류
$board  = array();
$board = get_board_db($bo_table, true);
if($board['bo_use_category']){
    $categories = explode("|", $board['bo_category_list']);
    //분류값이 없을경우 첫번째 분류값을 적용
    $ca_name = ($options['category'])?$options['category']:$categories[0];
}

//배경
$options['background'] = ($options['background'])?$options['background']:$latest_skin_url.'/img/foo_bo_bg2.png';

?>

    <div style="height:<?php echo $options['footer_h'];?>px;"></div>
    <style>
    .quotation{
        height:<?php echo $options['footer_h'];?>px;
        <?php if($options['bgcolor']){ ?>background-color:<?php echo $options['bgcolor'];?>;<?php } ?>
        <?php if($options['background']){ ?>background:url('<?php echo $options['background'];?>') center 0;<?php } ?>
    }
    .footer_counsel div, .footer_counsel span, .footer_counsel p, .footer_counsel img, .footer_counsel ul, .footer_counsel li, .footer_counsel form, .footer_counsel label{
        margin:0;
        padding:0;
        border:0;
        font-size:100%;
        vertical-align:baseline;
        background:transparent;
        font-family:'Nanum Gothic'
    }
    .footer_counsel ul, .footer_counsel li{
        list-style:none;
    }
    </style>

    <div id="footer_counsel" class="footer_counsel quotation font-ng">
        <div class="foo_coun">
            <form id="footer_counsel_form" method="post">
                <?php if($is_title){ ?>
                <p class="footer_str_count font-<?php echo $title_fs;?> <?php echo $title_fc;?> fw-100"><?php echo $title;?></p>
                <?php }else{ ?>
                <p class="footer_str_count">
                    <span class="footer_month"><?php echo date('m');?></span>월
                    <span class="footer_count"><?php echo number_format($total_count) ?></span>명의 고객들이
                    <span class="footer_month"><?php echo $config['cf_title'] ?></span>에 관심을 보여주셨습니다.
                </p>
                <?php } ?>
                <div class="f_a1">
                    <input type="checkbox" name="counsel_agree" value="yes" class="f_a2" checked="">  개인정보 취급방침 동의
                </div>
                <div class="foo_sonbox">
                    <ul>
                        <li class="f_a">
                            <label for="bsubject" style="float: left;">
                                <img src="<?php echo $latest_skin_url;?>/img/la_1.png">
                            </label>
                            <input type="text" name="counsel_name" class="is1" placeholder="이름">
                        </li>
                        <li class="f_b">
                            <label for="bsubject" style="float: left;">
                                <img src="<?php echo $latest_skin_url;?>/img/la_2.png">
                            </label>

                            <select name="region" class="is2">
                                <option value="">성별</option>
                                <option value="남성">남성</option>
                                <option value="여성">여성</option>
                            </select>

                            <select name="married" class="is2">
                                <option value="">결혼</option>
                                <option value="초혼">초혼</option>
                                <option value="재혼">재혼</option>
                            </select>

                        </li>
                    </ul>
                    <ul class="pt_1">
                        <li class="f_c">
                            <label for="bsubject" style="float: left;">
                                <img src="<?php echo $latest_skin_url;?>/img/la_3.png">
                            </label>
                            <input type="tel" id="counsel_tel1" name="counsel_tel1" maxlength="3" class="is3" value="010">
                        </li>
                        <li class="f_d"><input type="tel" id="counsel_tel2" name="counsel_tel2" maxlength="4" class="is3" placeholder=""></li>
                        <li class="f_d"><input type="tel" id="counsel_tel3" name="counsel_tel3" maxlength="4" class="is3" placeholder=""></li>
                    </ul>
                    <div class="f_bu">
                        <button type="button" id="footer_cousel_btn" class="f_bus bg-<?php echo $options['btnc'];?>" onclick="return fn_sendCounsel();">간편상담</button>
                    </div>
                </div>
            </form>
        </div>
        <script type="text/javascript">

            $(function () {
                //시작옵션

                $('input[name="counsel_tel1"]').keyup(function (e) {
                    var thisLen = $(this).val().length;
                    if (thisLen >= 3) {
                        $('input[name="counsel_tel2"]').focus();
                    }
                });

                $('input[name="counsel_tel2"]').keyup(function (e) {
                    var thisLen = $(this).val().length;
                    if (thisLen >= 4) {
                        $('input[name="counsel_tel3"]').focus();
                    }
                });

                //시작옵션
            });

            function fn_checkElement(selector, defvalue) {
                var retValue = false;
                $(selector).on('mouseleave',
                    function () {
                        $(selector).css('background-color', '#ffffff');
                    });
                if ($.trim($(selector).val()) == defvalue) {
                    if ($('#header_view_box').is(':visible')) {
                        $('#header_view_box').slideUp('slow');
                    }
                    $(selector).css('background-color', '#ffcc66').focus();
                    retValue = false;
                }
                else {
                    $(selector).css('background-color', '#ffffff');
                    retValue = true;
                }
                //alert(retValue);
                return retValue;
            }

            function fn_sendCounsel() {

                <?php if($is_login){ ?>
                if(g5_is_member != "1") {
                    alert('회원 로그인 후 이용해 주십시오.');
                    return false;
                }
                <?php } ?>

                if (fn_checkElement($('input[name="counsel_name"]'), '') == false) {
                    return false;
                }
                if (fn_checkElement($('select[name="region"]'), '') == false) {
                    return false;
                }
                if (fn_checkElement($('select[name="married"]'), '') == false) {
                    return false;
                }
                if (fn_checkElement($('input[name="counsel_tel1"]'), '') == false) {
                    return false;
                }
                if (fn_checkElement($('input[name="counsel_tel2"]'), '') == false) {
                    return false;
                }
                if (fn_checkElement($('input[name="counsel_tel3"]'), '') == false) {
                    return false;
                }
                if ($('input[name="counsel_agree"]').is(':checked') == false) {
                    alert('상담신청을 하려면 [개인정보수집방침]에 동의해 주시기 바랍니다.');
                    $('input[name="counsel_agree"]').focus();
                    return false;
                }

                if (confirm('입력하신 정보가 정확하시면 [확인] 버튼을 클릭하세요\n\n이름:  ' + $('input[name="counsel_name"]').val() + '\n성별:  ' + $('select[name="region"]').val() + '\n결혼:  ' + $('select[name="married"]').val() + '\n연락처: ' + $('input[name="counsel_tel1"]').val() + '-' + $('input[name="counsel_tel2"]').val() + '-' + $('input[name="counsel_tel3"]').val())) {


                    $.ajax({
                        url: "<?php echo $latest_skin_url;?>/ajax.request_save.php",
                        data: {

                            "is_login" : "<?php echo $is_login; ?>",
                            "bo_table" : "<?php echo $bo_table; ?>",
                            "ca_name" : "<?php echo $ca_name; ?>",
                            "name" : $('input[name="counsel_name"]').val(),
                            "region" : $('select[name="region"]').val(),
                            "married" : $('select[name="married"]').val(),
                            "tel1" : $('input[name="counsel_tel1"]').val(),
                            "tel2" : $('input[name="counsel_tel2"]').val(),
                            "tel3" : $('input[name="counsel_tel3"]').val()

                        },
                        type: "POST",
                        dataType: "json",
                        success: function(data){

                            if(data.error) {
                                alert(data.error);
                                return false;
                            }else{
                                alert('정상적으로 접수완료했습니다.');

                                $('input[name="counsel_agree"]').attr('checked',false);

                                $('input[name="counsel_name"]').val('');
                                $('select[name="region"]').val('');
                                $('select[name="married"]').val('');
                                $('input[name="counsel_tel1"]').val('');
                                $('input[name="counsel_tel2"]').val('');
                                $('input[name="counsel_tel3"]').val('');

                            }
                        }
                    });

                }
            }

            $(document).on('scroll', function (e) {
                var yPos = $(window).scrollTop();
                //console.log('yPos=' + yPos + ', height=' + $('#footer_counsel').css('height'));
                if (yPos == 0) {
                    if ($('#footer_counsel').css('height') == "<?php echo $options['footer_h'];?>px") {
                        $('#footer_counsel').animate({ height: "<?php echo $options['footer_h'];?>px" }, 0).stop().animate({ height: "0px" }, 500);
                    }
                }
                else {
                    if ($('#footer_counsel').css('height') == "0px") {
                        $('#footer_counsel').animate({ height: "0px" }, 0).stop().animate({ height: "<?php echo $options['footer_h'];?>px" }, 500);
                    }
                }
            });
        </script>
    </div>

이 질문에 댓글 쓰기 :

답변 1

<label> <input type="radio" name="region" value="남성"> 남성</label>
<label> <input type="radio" name="region" value="여성"> 여성</label>

 

이렇게 값을 넣어주셔야 됩니다. 

답변을 작성하시기 전에 로그인 해주세요.
전체 24
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1402호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT