시간대에 따라 정원수 예약받기

시간대에 따라 정원수 예약받기

QA

시간대에 따라 정원수 예약받기

답변 1

본문

예약폼을 작년에 의뢰해서 만들었습니다.

 

현재 만들어져있는 폼은

시간당 40명으로 동일한 정원수로 설정되어 있습니다.

 

그런데 올해는

시간대에 따라 정원수가 바뀌어야합니다.

 

 

10:30   40명

13:00   30명

15:00   30명

 

 

어디서 어떻게 수정해야하는지 아시는 분은 좀 알려주세요..

 

 

 

 

write_update.php파일에 있는 내용입니다.

 

 

 

if ($bo_table=="reservation") {
}
    $row = sql_fetch(" select sum(wr_8) as sum_wr_8 from $write_table where wr_4 = '$birth1-$birth2-$birth3-$birth4' ");
 $sum_wr_8 = $row[sum_wr_8];
 $sum = $wr_8 + $sum_wr_8;
 $cabable = 40 - $sum_wr_8;
 if ($sum > 40)
  alert("해당 시간에는 정원이 찼습니다. {$cabable}명만 예약 가능합니다. 인원수를 변경하시거나 다른 시간대에 예약해 주세요.");
}​
 

 

 

 

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

 

 

write.skin.php 내용입니다.

 

 
<? 
if ($is_dhtml_editor) {
    include_once("$g4[path]/lib/cheditor4.lib.php");
    echo "<script src='$g4[cheditor4_path]/cheditor.js'></script>";
    echo cheditor1('wr_content', '100%', '250');
}
/*
성명    name
성별    wr_1  
직장전화번호   wr_2
양력음력   wr_3
예약날짜 년 월 일  wr_4
자택전화번호 전화, hp   wr_6, 7
우편번호   wr_5
주소    wr_subject
인원    wr_8 
이메일    wr_email
홈페이지   wr_homepage
납부방법   wr_9
후원금액   wr_10
*/
//예약날짜
$birth = explode("-",$write[wr_4]); 
$birth1  = $birth[0];
$birth2  = $birth[1];
$birth3  = $birth[2];
$birth4  = $birth[3];
//예약인원
$wr_8 = ($write[wr_8]);
$wr_81  = $wr_8[0];
$wr_82  = $wr_8[1];
$wr_83  = $wr_8[2];
$wr_84  = $wr_8[3];
//우편번호
$ext5 = explode("-",$write[wr_5]); 
$ext5_00  = $ext5[0];
$ext5_01  = $ext5[1];
//자택 전화번호
$tel = explode("-",$write[wr_6]); 
$tel1  = $tel[0];
$tel2  = $tel[1];
$tel3  = $tel[2];

//직장 전화번호
$tel = explode("-",$write[wr_2]); 
$tel4  = $tel[0];
$tel5  = $tel[1];
$tel6  = $tel[2];
//휴대전화
$hp = explode("-",$write[wr_7]); 
$hp1  = $hp[0];
$hp2  = $hp[1];
$hp3  = $hp[2];
$p_nine = explode("|",$write[wr_9]);
$nine01 = $p_nine[0];
$nine02 = $p_nine[1];
?>
<script type="text/javascript">
function onlyNumber(obj) {
 if(isNaN(obj.value)){
  alert('숫자만 입력해 주세요');
   obj.value=obj.value.substr(0,obj.value.length-1)
 }
}
</script>
<style type="text/css">
<!--
.style2 {color: #4F4F4F}
-->
</style>

<div style="height:14px; line-height:1px; font-size:1px;"> </div>
<style type="text/css">
.hu_tb{width:98%; border:2px solid #99CC99; border-collapse:collapse;}
.hu_tb td{border-bottom:1px dotted #99CC99; padding-bottom:5px;}
.write_head { width:100px; height:30px; padding-right:15px; text-align:right; color:#333333; background-color:#F1F5E9;}
.field { }
.ed{border:1px solid #ddd; height:18px;}
</style>

<script language="javascript">
// 글자수 제한
var char_min = parseInt(<?=$write_min?>); // 최소
var char_max = parseInt(<?=$write_max?>); // 최대
</script>
<form name="fwrite" method="post" onsubmit="return fwrite_submit(this);" enctype="multipart/form-data" style="margin:0px;">
<input type=hidden name=null> 
<input type=hidden name=w        value="<?=$w?>">
<input type=hidden name=bo_table value="<?=$bo_table?>">
<input type=hidden name=wr_id    value="<?=$wr_id?>">
<input type=hidden name=sca      value="<?=$sca?>">
<input type=hidden name=sfl      value="<?=$sfl?>">
<input type=hidden name=stx      value="<?=$stx?>">
<input type=hidden name=spt      value="<?=$spt?>">
<input type=hidden name=sst      value="<?=$sst?>">
<input type=hidden name=sod      value="<?=$sod?>">
<input type=hidden name=page     value="<?=$page?>">
<table width="<?=$width?>" align=center cellpadding=0 cellspacing=0><tr><td>
<h3 class="font_nanum" style="color:#336699;"><? if ($member['mb_level'] >= 7) { ?><a href="../bbs/board.php?bo_table=<?=$bo_table?>"><img src="<?=$board_skin_path?>/img/sin.jpg" border="0" /></a>
 <? } ?>
</h3>
<table height="525" cellpadding="4" class="hu_tb">
<? 
$option = "";
$option_hidden = "";
if ($is_notice || $is_html || $is_secret || $is_mail) { 
    $option = "";
    if ($is_notice) { 
        $option .= "<input type=checkbox name=notice value='1' $notice_checked>공지 ";
    }
/*
    if ($is_html) {
        if ($is_dhtml_editor) {
            $option_hidden .= "<input type=hidden value='html1' name='html'>";
        } else {
            $option .= "<input onclick='html_auto_br(this);' type=checkbox value='$html_value' name='html' $html_checked><span class=w_title>html</span> ";
        }
    }
*/
    if ($is_secret) {
        if ($is_admin || $is_secret==1) {
            $option .= "<input type=checkbox value='secret' name='secret' $secret_checked><span class=w_title>비밀글</span> ";
        } else {
            $option_hidden .= "<input type=hidden value='secret' name='secret'>";
        }
    }
    
    if ($is_mail) {
        $option .= "<input type=checkbox value='mail' name='mail' $recv_email_checked>답변메일받기 ";
    }
}
echo $option_hidden;
if ($option) {
?>
<tr>
    <td class=write_head>옵 션</td>
    <td><?=$option?></td></tr>
<? } ?>
<? if ($is_category) { ?>
<tr>
    <td class=write_head>분 류</td>
    <td><select name=ca_name required itemname="분류"><option value="">선택하세요<?=$category_option?></select></td></tr>
<? } ?>
<? if ($is_name) { ?>
<tr>
    <td class=write_head>이 름</td>
    <td><input class='ed' maxlength=20 size=15 name=wr_name itemname="이름" required value="<?=$name?>"></td></tr>
<? } else {  ?>
<tr>
    <td class=write_head>이 름</td>
    <td><input class='ed' maxlength=20 size=15 name=wr_name itemname="이름" required value="<?=$member[mb_name]?>"></td></tr>
<? } ?>
<? if ($is_password) { ?>
<tr>
    <td class=write_head>비밀번호</td>
    <td><input class='ed' type=password maxlength=20 size=15 name=wr_password itemname="패스워드" <?=$password_required?>>
      <br /> 
      <span class="style2">* 신청접수증 출력시 또는 신청변경시 비밀번호가 필요하오니 꼭 기억하시기바랍니다</span></td>
</tr>
<? } ?>
<tr>
    <td class=write_head>휴대폰</td>
    <td>
 <!-- 휴대폰 시작 -->
  <select name='hp1' class='ed' itemname='휴대폰' required>
        <option value='010' <? if($hp1 == "010") echo "selected"; ?>>010</option>
        <option value='011' <? if($hp1 == "011") echo "selected"; ?>>011</option>
        <option value='016' <? if($hp1 == "016") echo "selected"; ?>>016</option>
        <option value='017' <? if($hp1 == "017") echo "selected"; ?>>017</option>
        <option value='018' <? if($hp1 == "018") echo "selected"; ?>>018</option>
        <option value='019' <? if($hp1 == "019") echo "selected"; ?>>019</option>
      </select> - 
      <input name='hp2' class=ed value='<?=$hp2?>' type='text' size='4' maxlength='4' required onkeydown='onlyNumber(this);' required itemname='휴대폰 두번째자리'>  - 
      <input name='hp3' class=ed value='<?=$hp3?>' type='text' size='4' maxlength='4' required onkeydown='onlyNumber(this);' required itemname='휴대폰 세번째자리'>
   <!-- 휴대폰 끝 --> </td></tr>
<tr>
    <td class=write_head>우편번호</td>
    <td>
 <input class=ed size="4" name=ext5_00 itemname="우편번호 앞자리" required readonly value="<?=$ext5_00?>"> -
 <input class=ed size="4" name=ext5_01 itemname="우편번호 뒷자리" required readonly value="<?=$ext5_01?>">
  <a href="javascript:;" onclick="win_zip('fwrite', 'ext5_00', 'ext5_01', 'wr_subject', 'wr_subject');"><img src="<?=$board_skin_path?>/img/addrsearch.gif" border=0 align="absmiddle"></a> </td></tr>
<tr>
    <td class=write_head>상세주소</td>
    <td>
 <input class="ed" style="width:60%;" name=wr_subject id="wr_subject" itemname="상세주소" required value="<?=$write[wr_subject]?>"> </td></tr>
<? if ($is_email) { ?>
<? } else {  ?>
<? } ?>
<tr>
    <td class=write_head>예약날짜</td>
    <td>
 <input name='birth1' value='2015' type='hidden'>
 <input name='birth2' value='07' type='hidden'>7월
 <input name='birth3' value='18' type='hidden'>
 18일
      시간 : 
    <select name='birth4' required itemname='시'>
  <option value="10:30" <? if ($birth4=="11") echo "selected"; ?>>10:30</option>
  <option value="13:00" <? if ($birth4=="12") echo "selected"; ?>>13:00</option>
  <option value="15:00" selected="selected" <? if ($birth4=="13") echo "selected"; ?>>15:00</option>
 </select>
    <select name='wr_8' required itemname='명'>
      <option value="1" selected="selected" <? if ($wr_8=="1") echo "selected"; ?>>1</option>
      <option value="2" <? if ($wr_8=="2") echo "selected"; ?>>2</option>
      <option value="3" <? if ($wr_8=="3") echo "selected"; ?>>3</option>
      <option value="4" <? if ($wr_8=="4") echo "selected"; ?>>4</option>
            </select>
    <!--<input class='ed' maxlength="4" size="4" name="wr_8" onkeydown='onlyNumber(this);' itemname="인원" value="<?=$write[wr_8]?>" />-->
    명(예약인원)</td>
</tr>
<tr>
    <td class=write_head style='padding-left:20px;'>전하실 말씀</td>
    <td style='padding:5px 0 5px 5px;'>
        <? if ($is_dhtml_editor) { ?>
            <?=cheditor2('wr_content', $content);?>
        <? } else { ?>
        <textarea id="wr_content" name="wr_content" class=tx style='width:90%; word-break:break-all; border:1px solid #ccc;' rows=5 itemname="전하실말씀" 
        <? if ($write_min || $write_max) { ?>onkeyup="check_byte('wr_content', 'char_count');"<?}?>><?=$content?></textarea>
        <? if ($write_min || $write_max) { ?><script language="javascript"> check_byte('wr_content', 'char_count'); </script><?}?>
        <? } ?>    </td>
</tr>
<? if ($is_guest) { ?>
<tr>
    <td class=write_head><img name="kcaptcha_image" width=100 height=40 border='0' id='kcaptcha_image' style="cursor:pointer;" title="글자가 잘안보이는 경우 클릭하시면 새로운 글자가 나옵니다." onclick="imageClick();"></td>
    <td><input class='ed' type=input size=10 name=wr_key itemname="자동등록방지" required>  <span style="color:#ff0000;">자동로봇 등록방지 - 왼쪽의 글자를 입력하세요.</span></td>
</tr>
<? } ?>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
    <td width="100%" align="center" valign="top" style="padding-top:30px;">
        <input type=image id="btn_submit" src="<?=$board_skin_path?>/img/submit.jpg" border=0 accesskey='s' align="absmiddle"> 
  <!--<a href="./board.php?bo_table=<?=$bo_table?>"><img id="btn_list" src="<?=$board_skin_path?>/img/btn_list.gif" border=0 align="absmiddle"></a>--> </td>
</tr>
</table>
</td></tr></table>
</form>
<div style="height:20px;"></div>
<script type="text/javascript" src="<?="../$g4[path]/js/jquery.kcaptcha.js"?>"></script>
<script type="text/javascript">
with (document.fwrite) 
{
    if (typeof(wr_name) != "undefined")
        wr_name.focus();
    else if (typeof(wr_subject) != "undefined")
        wr_subject.focus();
    else if (typeof(wr_content) != "undefined")
        wr_content.focus();
    if (typeof(ca_name) != "undefined")
        if (w.value == "u")
            ca_name.value = "<?=$write[ca_name]?>";
}
function html_auto_br(obj) 
{
    if (obj.checked) {
        result = confirm("자동 줄바꿈을 하시겠습니까?\n\n자동 줄바꿈은 게시물 내용중 줄바뀐 곳을<br>태그로 변환하는 기능입니다.");
        if (result)
            obj.value = "html2";
        else
            obj.value = "html1";
    }
    else
        obj.value = "";
}
function pay_type_change(val) {
    f = document.fwrite;
    if (val == "금액선택") {
        document.getElementById("pay_type_dsp").style.display = "block";
        document.getElementById("pay_type_dsp2").style.display = "none";
    } else {
        document.getElementById("pay_type_dsp").style.display = "none";
        document.getElementById("pay_type_dsp2").style.display = "block";
    }
}
function fwrite_submit(f) 
{
    <?
    if ($is_dhtml_editor) echo cheditor3('wr_content');
    ?>
    var subject = "";
    var content = "";
    $.ajax({
        url: "<?=$board_skin_path?>/ajax.filter.php",
        type: "POST",
        data: {
            "subject": f.wr_subject.value,
            "content": f.wr_content.value
        },
        dataType: "json",
        async: false,
        cache: false,
        success: function(data, textStatus) {
            subject = data.subject;
            content = data.content;
        }
    });
 if (!check_kcaptcha(f.wr_key)) { 
                return false; 
    } 
     document.getElementById('btn_submit').disabled = true;
 <?// if ($member['mb_level'] >= 7) { ?>
    // document.getElementById('btn_list').disabled = true;
 <? //} ?>
    <?
    if ($g4[https_url])
        echo "f.action = '$g4[https_url]/$g4[bbs]/write_update.php';";
    else
        echo "f.action = './write_update.php';";
    ?>
    
    return true;
}
</script>
<script language="JavaScript" src="<?="../$g4[path]/js/board.js"?>"></script>
<script language="JavaScript"> window.onload=function() { drawFont(); } </script>
 

​ 

이 질문에 댓글 쓰기 :

답변 1

 

write_update.php

 

 
$maxUser = 0;
switch($birth4) {
   case "11" :
    $maxUser = 40; //10:30
     break;
   case "12" :
    $maxUser = 30; //13:00
     break;
   case "13" :
    $maxUser = 30; //15:00
     break;     
 }
if ($bo_table=="reservation") {
}
    $row = sql_fetch(" select sum(wr_8) as sum_wr_8 from $write_table where wr_4 = '$birth1-$birth2-$birth3-$birth4' ");
 $sum_wr_8 = $row[sum_wr_8];
 $sum = $wr_8 + $sum_wr_8;
 $cabable = $maxUser - $sum_wr_8;
 if ($sum > $maxUser)
  alert("해당 시간에는 정원이 찼습니다. {$cabable}명만 예약 가능합니다. 인원수를 변경하시거나 다른 시간대에 예약해 주세요.");
}​
 
답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
전체 29
© SIRSOFT
현재 페이지 제일 처음으로