十年網(wǎng)站開發(fā)經(jīng)驗 + 多家企業(yè)客戶 + 靠譜的建站團隊
量身定制 + 運營維護+專業(yè)推廣+無憂售后,網(wǎng)站問題一站解決
今天就跟大家聊聊有關(guān)如何在PHP中使用mysql實現(xiàn)一個三級聯(lián)動菜單功能,可能很多人都不太了解,為了讓大家更加了解,小編給大家總結(jié)了以下內(nèi)容,希望大家根據(jù)這篇文章可以有所收獲。
具體如下:
數(shù)據(jù)庫mysql
-- 數(shù)據(jù)庫: `student` -- -- -------------------------------------------------------- -- -- 表的結(jié)構(gòu) `student` -- CREATE TABLE `student` ( `id` int(50) NOT NULL auto_increment, `name` varchar(50) collate utf8_unicode_ci NOT NULL, `dept` varchar(50) collate utf8_unicode_ci NOT NULL, `class` varchar(50) collate utf8_unicode_ci NOT NULL, `sex` varchar(50) collate utf8_unicode_ci NOT NULL, `dept_id` int(50) NOT NULL, `class_id` int(50) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=5 ; -- -- 導(dǎo)出表中的數(shù)據(jù) `student` -- INSERT INTO `student` (`id`, `name`, `dept`, `class`, `sex`, `dept_id`, `class_id`) VALUES (1, '計算機名字', '計算機工程系', '計061', '男', 1, 11), (2, '教計名字', '計算機工程系', '教技061', '男', 1, 14), (3, '管理名字', '管理系', '管理061', '女', 2, 21), (4, '機械名字', '機械工程系', '自動化061', '男', 3, 31);
index.php代碼:
下拉框連動 三級聯(lián)動演示:
看完上述內(nèi)容,你們對如何在PHP中使用mysql實現(xiàn)一個三級聯(lián)動菜單功能有進一步的了解嗎?如果還想了解更多知識或者相關(guān)內(nèi)容,請關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝大家的支持。