$states = array(
"NSW" => "NSW",
"VIC" => "VIC",
"QLD" => "QLD",
"SA" => "SA",
"WA" => "WA",
"TAS" => "TAS",
"NT" => "NT",
"ACT" => "ACT",
"OTH" => "OTH (AUS)",
"OVS" => "OVS (Overseas)"
);
現在我想要的值是select
和變量的值。PHP數組顯示值和變量
foreach ($states as $key => $value) {
$form_ret .= "<option value='".$key."'>".$key[1]."</option>";
}
,但我不能得到OVS (Overseas)
從OVS
準確值..
我真正想要得到的是這樣的:
<select name="State" id="State" >
<option value="NSW">NSW </option>
<option value="VIC">VIC </option>
<option value="QLD">QLD </option>
<option value="SA">SA </option>
<option value="WA">WA </option>
<option value="TAS">TAS </option>
<option value="NT">NT </option>
<option value="ACT">ACT </option>
<option value="OTH">OTH (AUS)</option>
<option value="OVS">OVS (Overseas)</option>
</select>
有沒有人有一個想法,我案件?在此先感謝
'$ form_ret。=「<選項值='「。$ key。」'>「。$ value。」「;'也許使用值變量?! – Rizier123 2015-02-24 01:44:54
而不是'$ key [1]'你只需使用'$ value'? – 2015-02-24 01:45:05
Déjàvue? @ Rizier123 - *下方... * – 2015-02-24 01:51:01