我在使用post发送多个单词值时遇到问题。例如,如果我发送字符串“Jazz and Blues”,它只发送“Jazz”。你知道问题出在哪里吗?谢谢你的帮助。
<select name="zaner" required>
<option value=""></option>
<?php
$z = array("Elektro", "Drum and Bass", "Hardcore", "House", "Techno", "Trance", "Dubstep", "Folk", "Pop", "Jazz and Blues", "Reggae", "RnB", "Rap", "Metal", "Punk", "Clasic", "Alternative", "Indie", "Rock", "Country", "Disco", "Funky", "Experimental", "Soul and ghospe");
foreach ($z as $zaner) {
echo "<option value=" .$zaner. ">" .$zaner. "</option>";
}
?>
</select>
答案 0 :(得分:0)
作为N.B.提到,您忘记在选择标记中指定multiple="multiple"
,即
<select name="zaner[]" multiple="multiple" required>
<option value=""></option>
<?php
$z = array("Elektro", "Drum and Bass", "Hardcore", "House", "Techno", "Trance", "Dubstep", "Folk", "Pop", "Jazz and Blues", "Reggae", "RnB", "Rap", "Metal", "Punk", "Clasic", "Alternative", "Indie", "Rock", "Country", "Disco", "Funky", "Experimental", "Soul and ghospe");
foreach ($z as $zaner) {
echo "<option value=" .$zaner. ">" .$zaner. "</option>";
}
?>
</select>