테스트 사이트 - 개발 중인 베타 버전입니다

회원가입수정 폼에서 onbur function이 작동을 잘 안합니다. 채택완료

회원가입수정폼에서 mb_1이란 필드값을 이용해 면허번호가 중복이 안되고, 숫자로 되게 할려고 합니다.



그런데 아래와 같이 제가 할수 있는대로 다 해봤는데 안됩니다.



테스트해보니 bbs/ajax.mb_1.php로 $_POST['mb_1']이 넘어오지 않습니다.



고진선처 부탁드립니다.



>>> skin/member/basic/register_form.skin.php





<th scope="row"><label for="reg_mb_1">면허번호<strong class="sound_only">필수</strong></label></th>

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <td>

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="frm_info">숫자만 입력 가능.</span>

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <input type="text" name="mb_1" value="<?php echo $member['mb_1'] ?>" id="reg_mb_1" <?php echo $required ?> <?php echo $readonly ?> class="frm_input minlength_3" maxlength="20" onblur="mb_1_check();">

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span id="msg_mb_1"></span>

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </td>



...

function mb_1_check() {

&nbsp; &nbsp; var msg = reg_mb_1_check();

&nbsp; &nbsp; if (msg) {

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $("#msg_mb_1").text(msg);

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $("#reg_mb_1").select();

&nbsp; &nbsp; } else

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $("#msg_mb_1").text("");&nbsp;

}

...</script>



>>> js/jquery.register_form.js



var reg_mb_1_check = function() {

&nbsp; &nbsp; var result = "";

&nbsp; &nbsp; $.ajax({

&nbsp; &nbsp; &nbsp; &nbsp; type: "POST",

&nbsp; &nbsp; &nbsp; &nbsp; url: g5_bbs_url+"/ajax.mb_1.php",

&nbsp; &nbsp; &nbsp; &nbsp; data: {

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "reg_mb_1": $("#reg_mb_1").val(),

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "reg_mb_id": encodeURIComponent($("#reg_mb_id").val())

&nbsp; &nbsp; &nbsp; &nbsp; },

&nbsp; &nbsp; &nbsp; &nbsp; cache: false,

&nbsp; &nbsp; &nbsp; &nbsp; async: false,

&nbsp; &nbsp; &nbsp; &nbsp; success: function(data) {

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; result = data;

&nbsp; &nbsp; &nbsp; &nbsp; }

&nbsp; &nbsp; });

&nbsp; &nbsp; return result;

}



>>> bbs/ajax.mb_1.php



<?php

include_once('./_common.php');

include_once(G5_LIB_PATH.'/register.lib.php');



$mb_1 = escape_trim($_POST['reg_1']);

$mb_id = escape_trim($_POST['reg_mb_id']);



if ($msg = valid_mb_1($mb_1)) die($msg);

if ($msg = exist_mb_1($mb_1, $mb_id)) die($msg);

?>



>>> lib/register.lib.php



function valid_mb_1($reg_mb_1)

{

&nbsp; if (!preg_match("/^[^0][0-9]{2,5}$/", $reg_mb_1))

&nbsp; &nbsp; &nbsp; &nbsp; return "면허번호가 형식에 맞지 않습니다.";

&nbsp; &nbsp; else

&nbsp; &nbsp; &nbsp; &nbsp; return "";

}



function exist_mb_1($reg_mb_1, $reg_mb_id)

{

&nbsp; &nbsp; global $g5;

&nbsp; &nbsp; $row = sql_fetch(" select count(*) as cnt from `{$g5['member_table']}` where mb_1 = '$reg_mb_1' and mb_id <> '$reg_mb_id' ");

&nbsp; &nbsp; if ($row['cnt'])

&nbsp; &nbsp; &nbsp; &nbsp; return "이미 사용중인 면허번호입니다.";

&nbsp; &nbsp; else

&nbsp; &nbsp; &nbsp; &nbsp; return "";

}



===











댓글을 작성하려면 로그인이 필요합니다.

답변 1개

채택된 답변
+20 포인트
"reg_mb_1": $("#reg_mb_1").val(), 라고 적어주셨는데..

$mb_1 = escape_trim($_POST['reg_1']); 는 reg_1 으로 받고 있네요.

$_POST['reg_mb_1'] 으로 수정해야할 듯 합니다.
로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

수정했더니 됩니다. 아무리 살펴봐도 눈에 안띄더니 바로 찾으시는군요. 감사합니다.

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인
🐛 버그신고