셀렉트 박스를 필수로 지정하는 방법이 있을까요. 정보
셀렉트 박스를 필수로 지정하는 방법이 있을까요.본문
이 소스를 보시면 첫번째 셀렉트 박스에서 "유효예약"은 필수로 되어있습니다.
해서 두번째 셀렉트 박스에서 "예약자"를 "유효예약"처럼 필수로 지정하고
싶은데 방법이 있을까요..;;;;
시도하다가 안되서 포기한 상태입니다.;;
<?
$sub_menu = "400600";
include_once("./_common.php");
include_once("$g4[path]/lib/latest.lib.php");
define("_INDEX_", TRUE);
include_once("./_head.php");
?>
<table width='100%' cellpadding=0 cellspacing=0>
<tr><td width='100%' height='3'></td></tr>
</table>
<table cellpadding=0 cellspacing=0 width=880>
<tr>
<td valign=top width=710>
<!-- 타이틀 테이블 -->
<table width='710' cellpadding=0 cellspacing=0>
<tr>
<td height=1 bgcolor=D8D8D8 colspan=4></td>
</tr>
<tr>
<td width=1 bgcolor=D8D8D8></td>
<td width=350 height=37 bgcolor=F4F4F4> <IMG SRC="images/icon_arrow_title.gif" WIDTH="19" HEIGHT="19" BORDER="0" ALT="" align=absmiddle> <FONT SIZE="3" COLOR="404141"><B>예약 접수 현황</B></FONT></td>
<td width=348 bgcolor=F4F4F4 align=right></td>
<td width=1 bgcolor=D8D8D8></td>
</tr>
<tr>
<td height=1 bgcolor=D8D8D8 colspan=4></td>
</tr>
<tr><td height=15></td></tr>
</table>
<!-- 타이틀 테이블 끝 -->
<!-- real start-->
<?
$where = " and ";
$sql_search = "";
if ($search != "")
{
if ($sel_field != "")
{
$sql_search .= " $where $sel_field like '%$search%' ";
$where = " and ";
}
}
if(!$bk_statuss || $bk_statuss == 0){
$sql_search .= " and a.bk_status in (0,1,2) ";
}else if($bk_statuss == 1){
$sql_search .= " ";
}else if($bk_statuss == 2){
$sql_search .= " and a.bk_status = 0 ";
}else if($bk_statuss == 3){
$sql_search .= " and a.bk_status = 1 ";
}else if($bk_statuss == 4){
$sql_search .= " and a.bk_status = 2 ";
}else if($bk_statuss == 5){
$sql_search .= " and a.bk_status = 4 ";
}else if($bk_statuss == 6){
$sql_search .= " and a.bk_status = 3 ";
}
if ($sel_field == "") $sel_field = "a.bk_id";
if ($sort1 == "") $sort1 = "a.bk_id";
if ($sort2 == "") $sort2 = "desc";
$sql_common = " from $cfg[table_bk_order] a
left join $cfg[table_bk_cart] b on (a.bn_uid=b.bn_uid)
where a.s_number=$s_number $sql_search ";
// 테이블의 전체 레코드수만 얻음
/*
$sql = " select count(bk_id) ".$sql_common;
$result = sql_query($sql);
$row = mysql_fetch_row($result);
mysql_free_result($result);
$total_count = $row[0];
*/
// 1.06.06
// left join 으로 인해 데이타 건수를 잘못 계산함 아래의 코드로 대체
$result = sql_query(" select DISTINCT bk_id ".$sql_common);
$total_count = mysql_num_rows($result);
// 전체 페이지 계산
$total_page = ceil($total_count / $cfg[page_rows]);
// 페이지가 없으면 첫 페이지 (1 페이지)
if ($page == "") $page = 1;
// 시작 레코드 구함
$from_record = ($page - 1) * $cfg[page_rows];
$sql = " select a.*,b.*, "._MISU_BOOK_."
$sql_common
group by a.bk_id
order by $sort1 $sort2
limit $from_record, $cfg[page_rows] ";
$result = sql_query($sql);
$qstr1 = "sel_ca_id=$sel_ca_id&sel_field=$sel_field&search=$search";
$qstr = "$qstr1&sort1=$sort1&sort2=$sort2&page=$page";
?>
<table width=100% cellpadding=0 cellspacing=0>
<form name=frmorderlist>
<input type=hidden name=doc value="<? echo $doc ?>">
<input type=hidden name=sort1 value="<? echo $sort1 ?>">
<input type=hidden name=sort2 value="<? echo $sort2 ?>">
<input type=hidden name=page value="<? echo $page ?>">
<tr>
<td width=20%> </td>
<td width=60% align=center>
<select name=bk_statuss>
<option value='0' <? if(!$bk_statuss || $bk_statuss == 0){ echo("selected"); } ?>>유효예약</option>
<option value='1' <? if($bk_statuss == 1){ echo("selected"); } ?>>전체보기</option>
<option value='2' <? if($bk_statuss == 2){ echo("selected"); } ?>>예약신청</option>
<option value='3' <? if($bk_statuss == 3){ echo("selected"); } ?>>예약확정</option>
<option value='4' <? if($bk_statuss == 4){ echo("selected"); } ?>>입금확인</option>
<option value='5' <? if($bk_statuss == 5){ echo("selected"); } ?>>예약취소</option>
<option value='6' <? if($bk_statuss == 6){ echo("selected"); } ?>>이용완료</option>
</select>
<select name=sel_field >
<option value='bk_name'>예약자</option>
<option value='bk_id'>예약번호</option>
<option value='bk_deposit_name'>입금자</option>
</select>
<input type=text name=search value='<? echo $search ?>' autocomplete="off">
<input type=image src='images/btn_search.gif' border=0 align=absmiddle>
</td>
<td width=20% align=right>건수 : <? echo $total_count ?> </td>
</tr>
</table><br>
<table width=100% cellpadding=2 cellspacing=1>
<tr><td colspan=20 height=3 bgcolor=#0E87F9></td></tr>
<tr align=center>
<td width=70 height=30>예약번호</td>
<td width=80>예약자</td>
<td width=50>예약상태</td>
<td width=30>객실</td>
<td width=55>예약금액</td>
<td width=55>예약취소</td>
<td width=40>할인</td>
<td width=55><FONT COLOR="1275D3">입금합계</font></td>
<td width=55>입금취소</td>
<td width=55><font color='#FF6600'>미수금</font></td>
<td width=60>결제수단</td>
<td width=30>수정</td>
</tr>
<tr><td colspan=20 height=1 bgcolor=#CCCCCC></td></tr>
<tr><td colspan=20 height=3 bgcolor=#F8F8F8></td></tr>
<?
$tot_itemcnt = 0;
$tot_orderamount = 0;
$tot_ordercancel = 0;
$tot_dc_amount = 0;
$tot_receiptamount = 0;
$tot_receiptcancel = 0;
$tot_misuamount = 0;
for ($i=0; $row=mysql_fetch_array($result); $i++) {
// 결제 수단
$s_receipt_way = $s_br = "";
if ($row[bk_temp_bank] > 0 || $row[bk_receipt_bank] > 0) {
$s_receipt_way = "무통장입금";
// $s_receipt_way = cut_str($row[bk_bank_account],8,"");
$s_br = "<br>";
}
if ($row[bk_temp_card] > 0 || $row[bk_receipt_card] > 0) {
// 미수금이 없고 카드결제를 하지 않았다면 카드결제를 선택후 무통장 입금한 경우임
if ($row[misuamount] <= 0 && $row[bk_receipt_card] == 0)
; // 화면 출력하지 않음
else {
$s_receipt_way .= $s_br."카드";
if ($row[od_receipt_card] == 0)
$s_receipt_way .= "<span class=small><span class=point style='font-size:8pt;'>(미승인)</span></span>";
$s_br = "<br>";
}
}
if ($row[bk_receipt_point] > 0)
$s_receipt_way .= $s_br."포인트";
$s_mod = icon("수정", "./orderform.php?bk_id=$row[bk_id]&$qstr");
$s_del = icon("삭제", "javascript:del('./orderdelete.php?od_id=$row[od_id]&on_uid=$row[on_uid]&mb_id=$row[mb_id]&$qstr');");
$s_date = get_date2($row[it_opt1]);
// if($row[receiptcancelbook] > $row[receiptamountbook]){
// $row[receiptcancelbook] = $row[receiptamountbook];
// }
if($row[misubook] < 0){
$row[misubook] = 0;
}
if($row[bk_status] == 0){
$bk_status = "예약신청";
}else if($row[bk_status] == 1){
$bk_status = "<FONT COLOR=\"blue\">예약확정</FONT>";
}else if($row[bk_status] == 2){
$bk_status = "<FONT COLOR=\"red\">입금확인</FONT>";
}else if($row[bk_status] == 3){
$bk_status = "<FONT COLOR=\"black\">이용완료</FONT>";
}
if($row[bookcancel] == $row[bookamount]){
$bk_status = "<FONT COLOR=\"pink\">예약취소</FONT>";
}
echo "
<tr $mouseover>
<td align=center title='주문일시 : $row[od_time]'>$row[bk_id]</td>
<td><a href='./shop_book.html?bk_statuss=$bk_statuss&sort1=$sort1&sort2=$sort2&sel_field=od_name&search=$row[od_name]'><span title='$od_deposit_name'>".cut_str($row[bk_name],8,"")."</span></a>";
?>
<?=help("전화:$row[bk_tel] \n핸드폰:$row[bk_hp]", 0, -100);?>
<? echo"</td>
<td align=center>$bk_status</td>
<td align=center>".nf($row[roomcount])."</td>
<td align=right><FONT COLOR='$f_color'>".nf($row[bookamount])."</font></td>
<td align=right>".nf($row[bookcancel])."</td>
<td align=right>".nf($row[bk_dc_amount])."</td>
<td align=right><FONT COLOR=1275D3>".nf($row[receiptamountbook])."</font></td>
<td align=right>".nf($row[receiptcancelbook])."</td>
<td align=right><FONT COLOR='#FF6600'>".nf($row[misubook])."</FONT></td>
<td align=center>$s_receipt_way</td>
<td align=center>$s_mod</a></td>
</tr><tr><td colspan=20 height=1 bgcolor=F5F5F5></td></tr>";
$tot_itemcount += $row[bookcount];
$tot_orderamount += $row[bookamount];
$tot_ordercancel += $row[bookcancel];
$tot_dc_amount += $row[od_dc_amount];
$tot_receiptamount += $row[receiptamountbook];
$tot_receiptcancel += $row[receiptcancelbook];
$tot_misu += $row[misubook];
}
mysql_free_result($result);
if ($i == 0)
echo "<tr><td colspan=20 align=center height=100 bgcolor=#ffffff><span class=point>예약이 한건도 없습니다.</span></td></tr>\n";
?>
</form>
<tr><td colspan=20 bgcolor=CCCCCC></td></tr>
<tr>
<td colspan=3 align=center>합 계</td>
<td align=center><?=(int)$tot_itemcount?>건</td>
<td align=right><FONT COLOR=1275D3><?=nf($tot_orderamount)?></FONT></td>
<td align=right><?=nf($tot_ordercancel)?></td>
<td align=right><?=nf($tot_dc_amount)?></td>
<td align=right><FONT COLOR=1275D3><?=nf($tot_receiptamount)?></FONT></td>
<td align=right><?=nf($tot_receiptcancel)?></td>
<td align=right><FONT COLOR=#FF6600><?=nf($tot_misu)?></FONT></td>
<td colspan=2></td>
</tr>
<tr><td colspan=20 bgcolor=CCCCCC></td></tr>
</table>
<table width=100%>
<tr bgcolor=#ffffff>
<td width=50%></td>
<td width=50% align=right>
<?=get_paging($config[cf_write_pages], $page, $total_page, "./shop_book.html?$qstr&page=");?>
</td>
</tr>
</table>
<script language="JavaScript">
<!--
var f = document.frmorderlist;
f.sel_field.value = '<? echo $sel_field ?>';
//-->
</script>
<!-- real end -->
<!-- 가운데 끝 -->
</td>
<td width=''> </td>
</tr>
</table>
<? include_once("./_tail.php"); ?>
해서 두번째 셀렉트 박스에서 "예약자"를 "유효예약"처럼 필수로 지정하고
싶은데 방법이 있을까요..;;;;
시도하다가 안되서 포기한 상태입니다.;;
<?
$sub_menu = "400600";
include_once("./_common.php");
include_once("$g4[path]/lib/latest.lib.php");
define("_INDEX_", TRUE);
include_once("./_head.php");
?>
<table width='100%' cellpadding=0 cellspacing=0>
<tr><td width='100%' height='3'></td></tr>
</table>
<table cellpadding=0 cellspacing=0 width=880>
<tr>
<td valign=top width=710>
<!-- 타이틀 테이블 -->
<table width='710' cellpadding=0 cellspacing=0>
<tr>
<td height=1 bgcolor=D8D8D8 colspan=4></td>
</tr>
<tr>
<td width=1 bgcolor=D8D8D8></td>
<td width=350 height=37 bgcolor=F4F4F4> <IMG SRC="images/icon_arrow_title.gif" WIDTH="19" HEIGHT="19" BORDER="0" ALT="" align=absmiddle> <FONT SIZE="3" COLOR="404141"><B>예약 접수 현황</B></FONT></td>
<td width=348 bgcolor=F4F4F4 align=right></td>
<td width=1 bgcolor=D8D8D8></td>
</tr>
<tr>
<td height=1 bgcolor=D8D8D8 colspan=4></td>
</tr>
<tr><td height=15></td></tr>
</table>
<!-- 타이틀 테이블 끝 -->
<!-- real start-->
<?
$where = " and ";
$sql_search = "";
if ($search != "")
{
if ($sel_field != "")
{
$sql_search .= " $where $sel_field like '%$search%' ";
$where = " and ";
}
}
if(!$bk_statuss || $bk_statuss == 0){
$sql_search .= " and a.bk_status in (0,1,2) ";
}else if($bk_statuss == 1){
$sql_search .= " ";
}else if($bk_statuss == 2){
$sql_search .= " and a.bk_status = 0 ";
}else if($bk_statuss == 3){
$sql_search .= " and a.bk_status = 1 ";
}else if($bk_statuss == 4){
$sql_search .= " and a.bk_status = 2 ";
}else if($bk_statuss == 5){
$sql_search .= " and a.bk_status = 4 ";
}else if($bk_statuss == 6){
$sql_search .= " and a.bk_status = 3 ";
}
if ($sel_field == "") $sel_field = "a.bk_id";
if ($sort1 == "") $sort1 = "a.bk_id";
if ($sort2 == "") $sort2 = "desc";
$sql_common = " from $cfg[table_bk_order] a
left join $cfg[table_bk_cart] b on (a.bn_uid=b.bn_uid)
where a.s_number=$s_number $sql_search ";
// 테이블의 전체 레코드수만 얻음
/*
$sql = " select count(bk_id) ".$sql_common;
$result = sql_query($sql);
$row = mysql_fetch_row($result);
mysql_free_result($result);
$total_count = $row[0];
*/
// 1.06.06
// left join 으로 인해 데이타 건수를 잘못 계산함 아래의 코드로 대체
$result = sql_query(" select DISTINCT bk_id ".$sql_common);
$total_count = mysql_num_rows($result);
// 전체 페이지 계산
$total_page = ceil($total_count / $cfg[page_rows]);
// 페이지가 없으면 첫 페이지 (1 페이지)
if ($page == "") $page = 1;
// 시작 레코드 구함
$from_record = ($page - 1) * $cfg[page_rows];
$sql = " select a.*,b.*, "._MISU_BOOK_."
$sql_common
group by a.bk_id
order by $sort1 $sort2
limit $from_record, $cfg[page_rows] ";
$result = sql_query($sql);
$qstr1 = "sel_ca_id=$sel_ca_id&sel_field=$sel_field&search=$search";
$qstr = "$qstr1&sort1=$sort1&sort2=$sort2&page=$page";
?>
<table width=100% cellpadding=0 cellspacing=0>
<form name=frmorderlist>
<input type=hidden name=doc value="<? echo $doc ?>">
<input type=hidden name=sort1 value="<? echo $sort1 ?>">
<input type=hidden name=sort2 value="<? echo $sort2 ?>">
<input type=hidden name=page value="<? echo $page ?>">
<tr>
<td width=20%> </td>
<td width=60% align=center>
<select name=bk_statuss>
<option value='0' <? if(!$bk_statuss || $bk_statuss == 0){ echo("selected"); } ?>>유효예약</option>
<option value='1' <? if($bk_statuss == 1){ echo("selected"); } ?>>전체보기</option>
<option value='2' <? if($bk_statuss == 2){ echo("selected"); } ?>>예약신청</option>
<option value='3' <? if($bk_statuss == 3){ echo("selected"); } ?>>예약확정</option>
<option value='4' <? if($bk_statuss == 4){ echo("selected"); } ?>>입금확인</option>
<option value='5' <? if($bk_statuss == 5){ echo("selected"); } ?>>예약취소</option>
<option value='6' <? if($bk_statuss == 6){ echo("selected"); } ?>>이용완료</option>
</select>
<select name=sel_field >
<option value='bk_name'>예약자</option>
<option value='bk_id'>예약번호</option>
<option value='bk_deposit_name'>입금자</option>
</select>
<input type=text name=search value='<? echo $search ?>' autocomplete="off">
<input type=image src='images/btn_search.gif' border=0 align=absmiddle>
</td>
<td width=20% align=right>건수 : <? echo $total_count ?> </td>
</tr>
</table><br>
<table width=100% cellpadding=2 cellspacing=1>
<tr><td colspan=20 height=3 bgcolor=#0E87F9></td></tr>
<tr align=center>
<td width=70 height=30>예약번호</td>
<td width=80>예약자</td>
<td width=50>예약상태</td>
<td width=30>객실</td>
<td width=55>예약금액</td>
<td width=55>예약취소</td>
<td width=40>할인</td>
<td width=55><FONT COLOR="1275D3">입금합계</font></td>
<td width=55>입금취소</td>
<td width=55><font color='#FF6600'>미수금</font></td>
<td width=60>결제수단</td>
<td width=30>수정</td>
</tr>
<tr><td colspan=20 height=1 bgcolor=#CCCCCC></td></tr>
<tr><td colspan=20 height=3 bgcolor=#F8F8F8></td></tr>
<?
$tot_itemcnt = 0;
$tot_orderamount = 0;
$tot_ordercancel = 0;
$tot_dc_amount = 0;
$tot_receiptamount = 0;
$tot_receiptcancel = 0;
$tot_misuamount = 0;
for ($i=0; $row=mysql_fetch_array($result); $i++) {
// 결제 수단
$s_receipt_way = $s_br = "";
if ($row[bk_temp_bank] > 0 || $row[bk_receipt_bank] > 0) {
$s_receipt_way = "무통장입금";
// $s_receipt_way = cut_str($row[bk_bank_account],8,"");
$s_br = "<br>";
}
if ($row[bk_temp_card] > 0 || $row[bk_receipt_card] > 0) {
// 미수금이 없고 카드결제를 하지 않았다면 카드결제를 선택후 무통장 입금한 경우임
if ($row[misuamount] <= 0 && $row[bk_receipt_card] == 0)
; // 화면 출력하지 않음
else {
$s_receipt_way .= $s_br."카드";
if ($row[od_receipt_card] == 0)
$s_receipt_way .= "<span class=small><span class=point style='font-size:8pt;'>(미승인)</span></span>";
$s_br = "<br>";
}
}
if ($row[bk_receipt_point] > 0)
$s_receipt_way .= $s_br."포인트";
$s_mod = icon("수정", "./orderform.php?bk_id=$row[bk_id]&$qstr");
$s_del = icon("삭제", "javascript:del('./orderdelete.php?od_id=$row[od_id]&on_uid=$row[on_uid]&mb_id=$row[mb_id]&$qstr');");
$s_date = get_date2($row[it_opt1]);
// if($row[receiptcancelbook] > $row[receiptamountbook]){
// $row[receiptcancelbook] = $row[receiptamountbook];
// }
if($row[misubook] < 0){
$row[misubook] = 0;
}
if($row[bk_status] == 0){
$bk_status = "예약신청";
}else if($row[bk_status] == 1){
$bk_status = "<FONT COLOR=\"blue\">예약확정</FONT>";
}else if($row[bk_status] == 2){
$bk_status = "<FONT COLOR=\"red\">입금확인</FONT>";
}else if($row[bk_status] == 3){
$bk_status = "<FONT COLOR=\"black\">이용완료</FONT>";
}
if($row[bookcancel] == $row[bookamount]){
$bk_status = "<FONT COLOR=\"pink\">예약취소</FONT>";
}
echo "
<tr $mouseover>
<td align=center title='주문일시 : $row[od_time]'>$row[bk_id]</td>
<td><a href='./shop_book.html?bk_statuss=$bk_statuss&sort1=$sort1&sort2=$sort2&sel_field=od_name&search=$row[od_name]'><span title='$od_deposit_name'>".cut_str($row[bk_name],8,"")."</span></a>";
?>
<?=help("전화:$row[bk_tel] \n핸드폰:$row[bk_hp]", 0, -100);?>
<? echo"</td>
<td align=center>$bk_status</td>
<td align=center>".nf($row[roomcount])."</td>
<td align=right><FONT COLOR='$f_color'>".nf($row[bookamount])."</font></td>
<td align=right>".nf($row[bookcancel])."</td>
<td align=right>".nf($row[bk_dc_amount])."</td>
<td align=right><FONT COLOR=1275D3>".nf($row[receiptamountbook])."</font></td>
<td align=right>".nf($row[receiptcancelbook])."</td>
<td align=right><FONT COLOR='#FF6600'>".nf($row[misubook])."</FONT></td>
<td align=center>$s_receipt_way</td>
<td align=center>$s_mod</a></td>
</tr><tr><td colspan=20 height=1 bgcolor=F5F5F5></td></tr>";
$tot_itemcount += $row[bookcount];
$tot_orderamount += $row[bookamount];
$tot_ordercancel += $row[bookcancel];
$tot_dc_amount += $row[od_dc_amount];
$tot_receiptamount += $row[receiptamountbook];
$tot_receiptcancel += $row[receiptcancelbook];
$tot_misu += $row[misubook];
}
mysql_free_result($result);
if ($i == 0)
echo "<tr><td colspan=20 align=center height=100 bgcolor=#ffffff><span class=point>예약이 한건도 없습니다.</span></td></tr>\n";
?>
</form>
<tr><td colspan=20 bgcolor=CCCCCC></td></tr>
<tr>
<td colspan=3 align=center>합 계</td>
<td align=center><?=(int)$tot_itemcount?>건</td>
<td align=right><FONT COLOR=1275D3><?=nf($tot_orderamount)?></FONT></td>
<td align=right><?=nf($tot_ordercancel)?></td>
<td align=right><?=nf($tot_dc_amount)?></td>
<td align=right><FONT COLOR=1275D3><?=nf($tot_receiptamount)?></FONT></td>
<td align=right><?=nf($tot_receiptcancel)?></td>
<td align=right><FONT COLOR=#FF6600><?=nf($tot_misu)?></FONT></td>
<td colspan=2></td>
</tr>
<tr><td colspan=20 bgcolor=CCCCCC></td></tr>
</table>
<table width=100%>
<tr bgcolor=#ffffff>
<td width=50%></td>
<td width=50% align=right>
<?=get_paging($config[cf_write_pages], $page, $total_page, "./shop_book.html?$qstr&page=");?>
</td>
</tr>
</table>
<script language="JavaScript">
<!--
var f = document.frmorderlist;
f.sel_field.value = '<? echo $sel_field ?>';
//-->
</script>
<!-- real end -->
<!-- 가운데 끝 -->
</td>
<td width=''> </td>
</tr>
</table>
<? include_once("./_tail.php"); ?>
댓글 전체
<select name="test" required>
그누보드라면 이처럼 required Attribute 를 추가해주시면 됩니다.
그누보드라면 이처럼 required Attribute 를 추가해주시면 됩니다.
흥힝힝님 답변주셔서 감사합니다.^^
<option value='bk_name'>예약자</option>
이것을 아래와 같이 수정했는데 필수로 지정이 안돼요^^;;;
<option value='bk_name' select name="bk_name" required>예약자</option>
ps.그누보드 맞습니다..
<option value='bk_name'>예약자</option>
이것을 아래와 같이 수정했는데 필수로 지정이 안돼요^^;;;
<option value='bk_name' select name="bk_name" required>예약자</option>
ps.그누보드 맞습니다..