Student
Student List Student ID First Name Last Name Course Year Section Section ID <?php $result = mysql_query("Select tbl_course.studno, tbl_course.studfname, tbl_course.studlname, tbl_coursetype.course_desc, tblyear.YearName, tblset.setname, tblset.ID from tbl_course, tbl_coursetype, tblyear, tblset where tbl_coursetype.course_no=tbl_course.studcourse AND tblyear.ID=tbl_course.studyear AND tblset.ID=tbl_course.studset", $connection); if (!$result) { die("Database query failed: " . mysql_error()); } // 4. Use returned data while ($row = mysql_fetch_array($result)) { echo ""; echo "".$row[0]." "; echo "".$row[1]." "; echo "".$row[2]." "; echo "".$row[3]." "; echo "".$row[4]." "; echo "".$row[5]." "; echo "".$row[6]." "; echo "View Subject "; echo " "; echo " "; echo " "; } ?>
– 以上是整个代码。 以下是截图。
我很困惑,因为BSIT只有第一年水平,但每当我选择BSIT时,第二次下降也会出现第3年水平,这是第3年仅适用于BSED。 简而言之,我希望每当我选择一个课程时,它会自动更改第二个下拉菜单及其相应的年级/ s。 我为此感到抱歉,但我只是想知道它是否可能以及如何实现? 如果可以,请教我。 谢谢!
就像我在评论中建议的那样,你可以使用chainedjs ,或者你可以创建自己的函数,如:
$( document ).ready(function() { $('#select1').on("change", function(){ var selectedClass = $(this).val(); //store the selected value $('#select2').val(""); //clear the second dropdown selected value //now loop through the 2nd dropdown, hide the unwanted options $('#select2 option').each(function () { var newValue = $(this).attr('class'); if (selectedClass != newValue && selectedClass != "") { $(this).hide(); } else{$(this).show(); } }); }); });
以上就是jQuery教程分享如何使用PHP将php变量从下拉列表传递到另一个下拉列表?相关内容,想了解更多jQuery开发(异常处理)及jQuery教程关注计算机技术网(www.ctvol.com)!)。
本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。
ctvol管理联系方式QQ:251552304
本文章地址:https://www.ctvol.com/jquerytutorial/561381.html
赞 (0)
jQuery技术:如何使用PHP将php变量从下拉列表传递到另一个下拉列表?
jQuery技术:intel xdk无法在android上运行
上一篇
2021年2月4日
jQuery技术:通过jQuery切换列表样式图像
下一篇
2021年2月4日