我需要选择用户在多选菜单中选择的选项.这是我到目前为止的代码,但仍然不起作用.谢谢您的帮助!
<select name="cb_estatura2[]" size="6" multiple="multiple" class="inputbox" id="cb_estatura2">
<?php
$height = array("57","58","59","60");
$choosen_height = $_GET['cb_estatura2'];
for ($i=0;$i<count($height);$i++)
{
$selected = ($height[$i] == $choosen_height[$i] ? 'selected="selected"' : '');
echo "<option value='$height[$i]' $selected>$height[$i]</option>";
}
?>
</select>
Run Code Online (Sandbox Code Playgroud) 我在PHP中进行搜索,对于特定字段,我需要搜索一个或多个可变值.例如.我需要显示"黑色"和"红色"头发的人的结果(我的变量是"头发").这时我只知道如何用一个值来做.例如.
...search.php&hair=black
Run Code Online (Sandbox Code Playgroud)
谢谢!