안녕하세요~
input type="checkbox" 를 필드값으로 추가하였는데요
수정하러 들어가보니 체크상태가 풀려있습니다~
이럴때는 어떤방법이있나요?
<div class="attr-value">
<input type="hidden" name="kboard_option_type_chk1" value="">
<input type="checkbox" name="kboard_option_type_chk1" value='<img src="/wp-content/uploads/detail_kboard/certified_logo_1.jpg" />'<?php if($content->option->type_chk1 == '<img src="/wp-content/uploads/detail_kboard/certified_logo_1.jpg" />'):?> checked<?php endif?>> 우수제품
<input type="hidden" name="kboard_option_type_chk2" value="">
<input type="checkbox" name="kboard_option_type_chk2" value='<img src="/wp-content/uploads/detail_kboard/certified_logo_2.jpg" />'<?php if($content->option->type_chk2 == '<img src="/wp-content/uploads/detail_kboard/certified_logo_2.jpg" />'):?> checked<?php endif?>> 특허
<input type="hidden" name="kboard_option_type_chk3" value="">
<input type="checkbox" name="kboard_option_type_chk3" value='<img src="/wp-content/uploads/detail_kboard/certified_logo_3.jpg" />'<?php if($content->option->type_chk3 == '<img src="/wp-content/uploads/detail_kboard/certified_logo_3.jpg" />'):?> checked<?php endif?>> 친환경
<input type="hidden" name="kboard_option_type_chk4" value="">
<input type="checkbox" name="kboard_option_type_chk4" value='<img src="/wp-content/uploads/detail_kboard/certified_logo_4.jpg" />'<?php if($content->option->type_chk4 == '<img src="/wp-content/uploads/detail_kboard/certified_logo_4.jpg" />'):?> checked<?php endif?>> 성능인증
<input type="hidden" name="kboard_option_type_chk5" value="">
<input type="checkbox" name="kboard_option_type_chk5" value='<img src="/wp-content/uploads/detail_kboard/certified_logo_5.jpg" />'<?php if($content->option->type_chk4 == '<img src="/wp-content/uploads/detail_kboard/certified_logo_5.jpg" />'):?> checked<?php endif?>> 단체표준
<input type="hidden" name="kboard_option_type_chk6" value="">
<input type="checkbox" name="kboard_option_type_chk6" value='<img src="/wp-content/uploads/detail_kboard/certified_logo_6.jpg" />'<?php if($content->option->type_chk4 == '<img src="/wp-content/uploads/detail_kboard/certified_logo_6.jpg" />'):?> checked<?php endif?>> 굿디자인
</div>
이렇게 진행해보니 제 생각과는 결과값이 다르네요 ..
안녕하세요~^^
<input> 태그의 value 값에 html 코드가 들어가면 문제가 될 수 있습니다.
아래의 코드처럼 사용해보시겠어요?
<div class="attr-value">
<input type="hidden" name="kboard_option_type_chk1" value="">
<input type="checkbox" name="kboard_option_type_chk1" value="1"<?php if($content->option->type_chk1 == '1'):?> checked<?php endif?>> 우수제품
</div>
출력하는 쪽에서는 아래의 코드로 출력하시면 됩니다.
<?php if($content->option->type_chk1 == '1'):?>
<img src="/wp-content/uploads/detail_kboard/certified_logo_1.jpg">
<?php endif?>
고맙습니다.
감사합니다 알려주신대로 진행하니 깔끔하게 해결되었습니다~!