체크박스 array 에 alret 을 어떻게 구현하나요?ㅠㅠ 부탁드립니다. 채택완료
코니팡
5년 전
조회 1,792
</span></pre>
<pre style="color: rgb(0, 0, 0); font-family: "굴림체"; font-size: 9pt; background-color: rgb(255, 255, 255);">
<span style="color: rgb(0, 0, 128); font-weight: bold; background-color: rgb(247, 250, 255);"><?php
</span><span style="color: rgb(102, 0, 0); background-color: rgb(247, 250, 255);">$wr_9_arr </span><span style="background-color: rgb(247, 250, 255);">= </span><span style="color: rgb(0, 0, 128); font-weight: bold; background-color: rgb(247, 250, 255);">array</span><span style="background-color: rgb(247, 250, 255);">( </span><span style="color: rgb(128, 128, 128); font-style: italic; background-color: rgb(247, 250, 255);">// 배열 설정
</span><span style="color: rgb(128, 128, 128); font-style: italic; background-color: rgb(247, 250, 255);"> </span><span style="color: rgb(0, 128, 0); font-weight: bold; background-color: rgb(247, 250, 255);">" 상품1" </span><span style="background-color: rgb(247, 250, 255);">=> </span><span style="color: rgb(0, 128, 0); font-weight: bold; background-color: rgb(247, 250, 255);">" 전자렌지 "</span><span style="background-color: rgb(247, 250, 255);">,
</span><span style="background-color: rgb(247, 250, 255);"> </span><span style="color: rgb(0, 128, 0); font-weight: bold; background-color: rgb(247, 250, 255);">" 상품2 " </span><span style="background-color: rgb(247, 250, 255);">=> </span><span style="color: rgb(0, 128, 0); font-weight: bold; background-color: rgb(247, 250, 255);">" 텔레비전 "</span><span style="background-color: rgb(247, 250, 255);">,
</span><span style="background-color: rgb(247, 250, 255);"> </span><span style="color: rgb(0, 128, 0); font-weight: bold; background-color: rgb(247, 250, 255);">" 상품3 " </span><span style="background-color: rgb(247, 250, 255);">=> </span><span style="color: rgb(0, 128, 0); font-weight: bold; background-color: rgb(247, 250, 255);">" 컴퓨터 "</span><span style="background-color: rgb(247, 250, 255);">,</span><span style="background-color: rgb(247, 250, 255);">
</span><span style="background-color: rgb(247, 250, 255);">);
</span><span style="color: rgb(0, 0, 128); font-weight: bold; background-color: rgb(247, 250, 255);">?></span>
<span style="background-color: rgb(239, 239, 239);"><</span><span style="color: rgb(0, 0, 128); font-weight: bold; background-color: rgb(239, 239, 239);">li </span><span style="color: rgb(0, 0, 255); font-weight: bold; background-color: rgb(239, 239, 239);">class</span><span style="color: rgb(0, 128, 0); font-weight: bold; background-color: rgb(239, 239, 239);">="bo_w_tit"</span><span style="background-color: rgb(239, 239, 239);">></span>
<span style="background-color: rgb(239, 239, 239);"><</span><span style="color: rgb(0, 0, 128); font-weight: bold; background-color: rgb(239, 239, 239);">div </span><span style="color: rgb(0, 0, 255); font-weight: bold; background-color: rgb(239, 239, 239);">class</span><span style="color: rgb(0, 128, 0); font-weight: bold; background-color: rgb(239, 239, 239);">="wli_tit"</span><span style="background-color: rgb(239, 239, 239);">></span>항목<span style="background-color: rgb(239, 239, 239);"></</span><span style="color: rgb(0, 0, 128); font-weight: bold; background-color: rgb(239, 239, 239);">div</span><span style="background-color: rgb(239, 239, 239);">></span>
<span style="background-color: rgb(239, 239, 239);"><</span><span style="color: rgb(0, 0, 128); font-weight: bold; background-color: rgb(239, 239, 239);">div </span><span style="color: rgb(0, 0, 255); font-weight: bold; background-color: rgb(239, 239, 239);">class</span><span style="color: rgb(0, 128, 0); font-weight: bold; background-color: rgb(239, 239, 239);">="wli_cnt wli_pickup"</span><span style="background-color: rgb(239, 239, 239);">></span>
<span style="color: rgb(0, 0, 128); font-weight: bold; background-color: rgb(247, 250, 255);"><?
</span><span style="color: rgb(0, 0, 128); font-weight: bold; background-color: rgb(247, 250, 255);"> </span><span style="color: rgb(102, 0, 0); background-color: rgb(247, 250, 255);">$wr_9 </span><span style="background-color: rgb(247, 250, 255);">= </span><span style="font-style: italic; background-color: rgb(247, 250, 255);">explode</span><span style="background-color: rgb(247, 250, 255);">(</span><span style="color: rgb(0, 128, 0); font-weight: bold; background-color: rgb(247, 250, 255);">","</span><span style="background-color: rgb(247, 250, 255);">, </span><span style="color: rgb(102, 0, 0); background-color: rgb(247, 250, 255);">$write</span><span style="background-color: rgb(247, 250, 255);">[</span><span style="color: rgb(0, 128, 0); font-weight: bold; background-color: rgb(247, 250, 255);">'wr_9'</span><span style="background-color: rgb(247, 250, 255);">]);
</span><span style="background-color: rgb(247, 250, 255);"> </span><span style="color: rgb(0, 0, 128); font-weight: bold; background-color: rgb(247, 250, 255);">foreach</span><span style="background-color: rgb(247, 250, 255);">(</span><span style="color: rgb(102, 0, 0); background-color: rgb(247, 250, 255);">$wr_9_arr </span><span style="color: rgb(0, 0, 128); font-weight: bold; background-color: rgb(247, 250, 255);">as </span><span style="color: rgb(102, 0, 0); background-color: rgb(247, 250, 255);">$key </span><span style="background-color: rgb(247, 250, 255);">=> </span><span style="color: rgb(102, 0, 0); background-color: rgb(247, 250, 255);">$val</span><span style="background-color: rgb(247, 250, 255);">) {
</span><span style="background-color: rgb(247, 250, 255);"> </span><span style="color: rgb(128, 128, 128); font-style: italic; background-color: rgb(247, 250, 255);">//$chk = in_array($key, $wr_9) ? " checked" : "";
</span><span style="color: rgb(128, 128, 128); font-style: italic; background-color: rgb(247, 250, 255);"> </span><span style="color: rgb(0, 0, 128); font-weight: bold; background-color: rgb(247, 250, 255);">if</span><span style="background-color: rgb(247, 250, 255);">(</span><span style="color: rgb(102, 0, 0); background-color: rgb(247, 250, 255);">$key </span><span style="background-color: rgb(247, 250, 255);">== </span><span style="color: rgb(0, 128, 0); font-weight: bold; background-color: rgb(247, 250, 255);">" 상품1 "</span><span style="background-color: rgb(247, 250, 255);">) {
</span><span style="background-color: rgb(247, 250, 255);"> </span><span style="color: rgb(102, 0, 0); background-color: rgb(247, 250, 255);">$chk </span><span style="background-color: rgb(247, 250, 255);">= </span><span style="color: rgb(0, 128, 0); font-weight: bold; background-color: rgb(247, 250, 255);">" checked"</span><span style="background-color: rgb(247, 250, 255);">;
</span><span style="background-color: rgb(247, 250, 255);"> } </span><span style="color: rgb(0, 0, 128); font-weight: bold; background-color: rgb(247, 250, 255);">else </span><span style="background-color: rgb(247, 250, 255);">{
</span><span style="background-color: rgb(247, 250, 255);"> </span><span style="color: rgb(102, 0, 0); background-color: rgb(247, 250, 255);">$chk </span><span style="background-color: rgb(247, 250, 255);">= </span><span style="font-style: italic; background-color: rgb(247, 250, 255);">in_array</span><span style="background-color: rgb(247, 250, 255);">(</span><span style="color: rgb(102, 0, 0); background-color: rgb(247, 250, 255);">$key</span><span style="background-color: rgb(247, 250, 255);">, </span><span style="color: rgb(102, 0, 0); background-color: rgb(247, 250, 255);">$wr_9</span><span style="background-color: rgb(247, 250, 255);">) ? </span><span style="color: rgb(0, 128, 0); font-weight: bold; background-color: rgb(247, 250, 255);">" checked" </span><span style="background-color: rgb(247, 250, 255);">: </span><span style="color: rgb(0, 128, 0); font-weight: bold; background-color: rgb(247, 250, 255);">""</span><span style="background-color: rgb(247, 250, 255);">;
</span><span style="background-color: rgb(247, 250, 255);"> }
</span><span style="background-color: rgb(247, 250, 255);"> </span><span style="color: rgb(0, 0, 128); font-weight: bold; background-color: rgb(247, 250, 255);">echo </span><span style="color: rgb(0, 128, 0); font-weight: bold; background-color: rgb(247, 250, 255);">"<label><input type='checkbox' name='wr_9[]' value='"</span><span style="background-color: rgb(247, 250, 255);">.</span><span style="color: rgb(102, 0, 0); background-color: rgb(247, 250, 255);">$key</span><span style="background-color: rgb(247, 250, 255);">.</span><span style="color: rgb(0, 128, 0); font-weight: bold; background-color: rgb(247, 250, 255);">"'"</span><span style="background-color: rgb(247, 250, 255);">.</span><span style="color: rgb(102, 0, 0); background-color: rgb(247, 250, 255);">$chk</span><span style="background-color: rgb(247, 250, 255);">.</span><span style="color: rgb(0, 128, 0); font-weight: bold; background-color: rgb(247, 250, 255);">">"</span><span style="background-color: rgb(247, 250, 255);">.</span><span style="color: rgb(102, 0, 0); background-color: rgb(247, 250, 255);">$val</span><span style="background-color: rgb(247, 250, 255);">.</span><span style="color: rgb(0, 128, 0); font-weight: bold; background-color: rgb(247, 250, 255);">"</label> "</span><span style="background-color: rgb(247, 250, 255);">;
</span><span style="background-color: rgb(247, 250, 255);"> }
</span>
<span style="background-color: rgb(247, 250, 255);"> </span><span style="color: rgb(0, 0, 128); font-weight: bold; background-color: rgb(247, 250, 255);">?></span>
<span style="color: rgb(0, 0, 128); font-weight: bold;"> </span><span style="background-color: rgb(239, 239, 239);"></</span><span style="color: rgb(0, 0, 128); font-weight: bold; background-color: rgb(239, 239, 239);">div</span><span style="background-color: rgb(239, 239, 239);">></span>
<span style="background-color: rgb(239, 239, 239);"></</span><span style="color: rgb(0, 0, 128); font-weight: bold; background-color: rgb(239, 239, 239);">li</span><span style="background-color: rgb(239, 239, 239);">></span></pre>
<p><font style="background-color: rgb(239, 239, 239);">
상품1은 기본체크로 되어 있습니다.
상품2를 체크했을때 나오는 얼렛과
상품1을 체크 뺐을때 나오는 얼렛을
하고싶습니다. ㅠㅠ
댓글을 작성하려면 로그인이 필요합니다.
답변 1개
답변을 작성하려면 로그인이 필요합니다.
로그인