input 박스에서 0 을 입력하면 값이 전송이 되지 않나요? 정보
input 박스에서 0 을 입력하면 값이 전송이 되지 않나요?본문
input 박스에서 0 을 입력하여 서브밋을 하면 입력된 값이 없다고 값을 답는 페이지에서에서 경고창을 보냅니다.
해결 방법이 없을까요?
================= 입력페이지 ====================
<form name=auction_tender id=auction_tender method=post action="<?=$board_skin_path?>/tender.php" target=hiddenframe style="margin:18px 0 0 0; float:left;">
<input type=hidden name=bo_table value=<?=$bo_table?>>
<input type=hidden name=wr_id value=<?=$wr_id?>>
<input type="image" src="<?=$board_skin_path?>/img/ball/ballN00.png" onclick="document.getElementById('point').value='0'; return false;" />
<input type="image" src="<?=$board_skin_path?>/img/ball/ballN01.png" onclick="document.getElementById('point').value='1'; return false;" />
<input type="image" src="<?=$board_skin_path?>/img/ball/ballN02.png" onclick="document.getElementById('point').value='2'; return false;" />
<input type="image" src="<?=$board_skin_path?>/img/ball/ballN03.png" onclick="document.getElementById('point').value='3'; return false;" />
<input type="image" src="<?=$board_skin_path?>/img/ball/ballN04.png" onclick="document.getElementById('point').value='4'; return false;" />
<input type="image" src="<?=$board_skin_path?>/img/ball/ballN05.png" onclick="document.getElementById('point').value='5'; return false;" />
<input type="image" src="<?=$board_skin_path?>/img/ball/ballN06.png" onclick="document.getElementById('point').value='6'; return false;" />
<input type="image" src="<?=$board_skin_path?>/img/ball/ballN07.png" onclick="document.getElementById('point').value='7'; return false;" />
<input type="image" src="<?=$board_skin_path?>/img/ball/ballN08.png" onclick="document.getElementById('point').value='8'; return false;" />
<input type="image" src="<?=$board_skin_path?>/img/ball/ballN09.png" onclick="document.getElementById('point').value='9'; return false;" />
<br />
<input type=text name=point id=point value="" required numeric itemname="구매 번호" style=" border:1px solid #D3D3D3; width:80px; text-align:right; padding-right:10px;">
번호를 구매하겠습니다.
</form>
=====================값을 받는 페이지============
<?
$g4_path = "../../..";
include_once("$g4_path/common.php");
if (!$bo_table && !$wr_id)
die("bo_table 혹은 wr_id 가 없습니다.");
include_once("$board_skin_path/auction.lib.php");
include_once("$g4[path]/head.sub.php");
if (!$write)
alert_only("bo_table 과 wr_id 를 확인하십시오.");
if (!$point && !point==0)
alert_only("구매하실 번호를 입력해주세요.");
tender_send($wr_id, $point);
?>
해결 방법이 없을까요?
================= 입력페이지 ====================
<form name=auction_tender id=auction_tender method=post action="<?=$board_skin_path?>/tender.php" target=hiddenframe style="margin:18px 0 0 0; float:left;">
<input type=hidden name=bo_table value=<?=$bo_table?>>
<input type=hidden name=wr_id value=<?=$wr_id?>>
<input type="image" src="<?=$board_skin_path?>/img/ball/ballN00.png" onclick="document.getElementById('point').value='0'; return false;" />
<input type="image" src="<?=$board_skin_path?>/img/ball/ballN01.png" onclick="document.getElementById('point').value='1'; return false;" />
<input type="image" src="<?=$board_skin_path?>/img/ball/ballN02.png" onclick="document.getElementById('point').value='2'; return false;" />
<input type="image" src="<?=$board_skin_path?>/img/ball/ballN03.png" onclick="document.getElementById('point').value='3'; return false;" />
<input type="image" src="<?=$board_skin_path?>/img/ball/ballN04.png" onclick="document.getElementById('point').value='4'; return false;" />
<input type="image" src="<?=$board_skin_path?>/img/ball/ballN05.png" onclick="document.getElementById('point').value='5'; return false;" />
<input type="image" src="<?=$board_skin_path?>/img/ball/ballN06.png" onclick="document.getElementById('point').value='6'; return false;" />
<input type="image" src="<?=$board_skin_path?>/img/ball/ballN07.png" onclick="document.getElementById('point').value='7'; return false;" />
<input type="image" src="<?=$board_skin_path?>/img/ball/ballN08.png" onclick="document.getElementById('point').value='8'; return false;" />
<input type="image" src="<?=$board_skin_path?>/img/ball/ballN09.png" onclick="document.getElementById('point').value='9'; return false;" />
<br />
<input type=text name=point id=point value="" required numeric itemname="구매 번호" style=" border:1px solid #D3D3D3; width:80px; text-align:right; padding-right:10px;">
번호를 구매하겠습니다.
</form>
=====================값을 받는 페이지============
<?
$g4_path = "../../..";
include_once("$g4_path/common.php");
if (!$bo_table && !$wr_id)
die("bo_table 혹은 wr_id 가 없습니다.");
include_once("$board_skin_path/auction.lib.php");
include_once("$g4[path]/head.sub.php");
if (!$write)
alert_only("bo_table 과 wr_id 를 확인하십시오.");
if (!$point && !point==0)
alert_only("구매하실 번호를 입력해주세요.");
tender_send($wr_id, $point);
?>
댓글 전체
단순히 if(!$point){} 조건문은 변수값이 없는 경우 뿐 아니라 0의 경우도 포함됩니다.
이 경우에는 if($point==''){} 혹은 if($point==null){} 등으로 처리하심이
이 경우에는 if($point==''){} 혹은 if($point==null){} 등으로 처리하심이
감사합니다. 초보인데요, 하나씩 배워 나갑니다. ^^