상품등록시 판매가격 넣으면 옆에 자동계산후 값 나오게하기

상품등록시 판매가격 넣으면 옆에 자동계산후 값 나오게하기

QA

상품등록시 판매가격 넣으면 옆에 자동계산후 값 나오게하기

답변 2

본문

상품등록시 판매가격 넣으면 옆에 자동계산후 값 나오게하기 위해서

아래와 같이 해봤는데 답이 안나오네요..

그리고 가격을 넣었을때 옆에 바로 보였으면 하는데 조언좀 부탁드리겠습니다.

 


<tr>
            <th scope="row"><label for="it_price">판매가격</label></th>
            <td>
                <input type="text" name="it_price" value="<?php echo $it['it_price']; ?>" id="it_price" class="frm_input" size="8"> 원
            </td>
            <th scope="row"> <td><?php echo $$it_price*0.88; ?> 원</td></th>
        </tr>

 

 

https://gnustudy.com/bbs/board.php?bo_table=yc_tip&wr_id=22
혹시나 해서 위내용처럼 여분필드도 써 봤는데 어렵네요 ㅠㅠ

 


<?php 
$it_1 = $it_price*0.88; 
?>
 
<tr>
            <th scope="row"><label for="it_price">판매가격</label></th>
            <td>
                <input type="text" name="it_price" value="<?php echo $it['it_price']; ?>" id="it_price" class="frm_input" size="8"> 원
            </td>
            <th scope="row"><td><?php echo $it_1; ?> 원</td></th>
        </tr>

 

이 질문에 댓글 쓰기 :

답변 2

간단한 예제 남깁니다.


        <tr>
            <th scope="row"><label for="it_price">판매가격</label></th>
            <td>
                <input type="text" name="it_price" value="<?php echo $it['it_price']; ?>" id="it_price" class="frm_input" size="8" onkeyup="document.getElementById('cal_price').innerText=( parseInt(this.value)|0)*0.88"> 원
            </td>
            <th scope="row"> <td><span id="cal_price"><?=$it['it_price']*0.88?></span> 원</td></th>
        </tr>

입력 시 바로 처리가 되게 하려면, JAVASCRRIPT나 JQEURY 공부하셔야 할 듯...

답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
전체 123,161
© SIRSOFT
현재 페이지 제일 처음으로