0
我尝试使用jquery searchabledropdown插件时无法为我的select字段获取php POST变量。如果我注释掉jQuery,我可以很好地获得POST表单数据。但是,如果我添加下拉列表(从数据库中提取数据并将值分配给select,$ _POST变量就会变回空白。对于使用插件和下拉列表的每个实例,所有浏览器都会发生这种情况。搜索这个论坛的最后一个星期,并试图分配一个隐藏的价值和所有其他类似的解决方案,没有成功。jQuery的大师能提供一些帮助?
editclass.php
<script src='/app/js/spectrum.js'></script>
<link rel="stylesheet" type="text/css" href='/app/css/spectrum.css' />
<script type="text/javascript" src="/app/js/jquery.searchabledropdown-1.0.8.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#grade").searchable();
});
</script>
<?php
$sql="select value,type_id from type where category='grade' and active_flg=1 order by value";
$result=mysql_query($sql);
$gradevalues="<option value=0>Search:</option>";
while($row=mysql_fetch_array($result)){
if($teacherid1==$row['person_id']){$selected1="selected";}else{$selected1="";}
$grade=$row['value'];
$typeid=$row['type_id'];
$gradevalues.='<option '.$selected1.' value="'.$typeid.'">'.$grade.'</option>';
}?>
<form action="/app/forms/editclass_post.php" method="POST" >
<select name="grade" id="grade">
<?php echo $gradevalues;?>
</select>
<input type="submit" name="submit" value="Update Class" class="button">
</form>
editclass_post.php
<?php
echo $_POST['grade'];
?>
哦顺便说一句似乎并不像jquery searchabledropdown与jquery-1.9.1很好地搭配,所以你可能不得不使用jquery-1.8.3。 – 2013-05-17 14:45:24