안녕하세요 나는이사전 설정 값을 선택
[creditCardList] => array(6) (
[0] => stdClass object {
text_code => (string) 1
text_value => (string) Visa
}
[1] => stdClass object {
text_code => (string) 2
text_value => (string) MasterCard
}
[2] => stdClass object {
text_code => (string) 3
text_value => (string) Eurocard
}
[3] => stdClass object {
text_code => (string) 4
text_value => (string) Amex
}
[4] => stdClass object {
text_code => (string) 5
text_value => (string) Diners
}
[5] => stdClass object {
text_code => (string) 6
text_value => (string) Other
}
)
내가 값을 미리 설정하고자하는 HTML 페이지에서로드 text_code 1 점이다 페이지에서 PLC로 전송하고 정보의 목록을 가지고 , 그것은 VISA 다. 그러나 나는 그것을 달성 할 수 없다. 다음은 html 코드입니다. $creditCardList->text_code[1]
을 작성했지만 작동하지 않았습니다.
<select name="credit_card_select" id="my_profile_select_credit_card" class="form-control country_style">
<?php
if(!($userriskrate['credit_card_type'] > 0)){
echo '<option value="' . $creditCardList->text_code[1]. '">' . $creditCard->text_value . '</option>';
foreach ($creditCardList as $creditCard){
echo '<option value="' . $creditCard->text_code. '">' . $creditCard->text_value . '</option>';
}
}else{
foreach ($creditCardList as $creditCard){
echo '<option value="' . $creditCard->text_code. '"';
if($creditCard->text_code == $userriskrate['credit_card_type']){
echo 'selected';
}
echo '>' . $creditCard->text_value .'';
echo '</option>';
}
}
?>
</select>
@Farhana, 이건 당신을 위해 일하지 못했습니다. – coder
죄송합니다. 작동하지 않아 빈 필드를 보여 주셨습니다. – FaF
@Farhana 죄송합니다. creditcardList [0] -> text_value 대신 creditcard [0] -> text_value를 썼습니다. 텍스트 코드 부분이 정확했습니다. 내 나쁜 – coder