<select name="fruits">
<option value="apple">Apple</option>
<option value="orange">Orange</option>
<option value="pears">Pears</option>
</select>
/* fruits stored in the database */
<?php $items as $each_fruit) {
$fruit_count++;
$a[]=$each_fruit->fruit_name;
?>
所选值已存储在数据库中。我不想再允许加入水果......
如何使用javascript检查?
答案 0 :(得分:0)
<?php $items as $each_fruit) {
$fruit_count++;
$a[]=$each_fruit->fruit_name;
?>
$ selectedValue - 将用户选择的值分配给此变量
if (!in_array($selectedValue, $a)) {
// Do your stuff