在我的下拉框中,这是一个必填字段,但即使选择了某些内容,也会出现验证消息,
if(empty($data['department']) || strlen($data['department']) )
{
$err[] = "ERROR - Please enter the department you are applying for.";
}
这是从
$insert = "INSERT into users
`department`, VALUES ( '$data[department] )";
HTML:
<td>Department<span class="required">*</span> </td>
<td><select name="department" id="department">
<option value="" selected></option>
<option <? if($department == '1') { ?> selected <? } ?>
value="1">1</option>
<option <? if($department== '2') { ?> selected <? } ?> value="2">2
</option>
<option <? if($department == '3') { ?> selected <? } ?>
value="3">3</option>
</select>