체크한 줄의 값이 특정값일 경우 조건문
본문
for($i=0; $row=sql_fetch_array($result); $i++) {
for($k=0; $opt=sql_fetch_array($res); $k++) {
<td><input type="checkbox" name="chk[]" value="<?php echo $i ?>" id="chk_<?php echo $i; ?>"></td>
<td headers="th_itst" class="td_mngsmall"><?php echo $opt['ct_status']; ?></td>
}
}
<div class="orderreturn_btn01"><input type="submit" value="교환신청" name="act_button" onclick="document.pressed=this.value"></div>
이렇게 소스가 있고
저기 체크박스 체크했을 때
체크한 줄의 $opt['ct_status']가 '1'이면
<div class="orderreturn_btn01"><input type="submit" value="교환신청" disabled="true"></div>
그 외에는
<div class="orderreturn_btn01"><input type="submit" value="교환신청" name="act_button" onclick="document.pressed=this.value"></div>
로 하고 싶은데 어떻게 해야 하나요?
!-->답변 2
왜 반복이 있는지 모르겠지만 조건문은 아래와 같습니다.
PHP 5.3이상
<div class="orderreturn_btn01"><input type="submit" value="교환신청" <?= $opt['ct_status'] === 1 ? 'name="act_button" onclick="document.pressed=this.value"' : 'isabled="true"'; ?>></div>
for문의로 생성된 체크박스를 클릭했을때 <div class="orderreturn_btn01">내용이 바뀌게 하시려면
아래 checkbox를 클릭하는 이벤트를 받아 submit 내용을 바뀌도록 스크립트를 만들어 넣어주셔야 합니다
답변을 작성하시기 전에 로그인 해주세요.