-1 down vote favorite Here I'm facing problem with course registration. I have 3 tables named as dept(dept_id,dept_name) where dept_id is a primary key 2nd table is semester (semester_id, semester_name,dept_id) semester_id is a primary key and dept_id is a foreign key .3rd table is courses(c_id,dept_id,sem_id,c_name) where c_id is primary key and dept_id and sem_id is a foreign key. I have 3 combo boxes: 1st regarding department (select* from dept) <option value="<?php echo $sql_res1["dept_id"]; ?>" <?php if($sql_res1["dept_id"]==$_REQUEST["dept_id"]) { echo "Selected"; } ?>><?php echo $sql_res1["dept_name"]; ?></option> <?php } ?> 2nd combo box is semester : select * from semester where dept_id='$_REQUEST[dept_id]'"; 3rd combo box is courses. I don't know how to query in it. I want that if department is equal to computer science and semester is equal to 1st then 3rd combo box will show their relevant courses same if department is law and semester is equal to 2nd then 3rd combo box shows their relevant courses. <script language="javascript" type="text/javascript"> function showCom(cid) { document.frm.submit(); }</script> <select name="c_id" id="c_id" onChange="showComp(this.value);"> <option value="">--Select--</option> <?php $sql1="SELECT c.* FROM courses c WHERE c.cat_id='$_REQUEST[cat_id]'"; $sql_row1=mysql_query($sql1); while($sql_res1=mysql_fetch_assoc($sql_row1)){ ?> <option value="<?php echo $sql_res1["c_id"]; ?>" <?php if($sql_res1["c_id"]==$_REQUEST["c_id"]) { echo "Selected"; } ?>><?php echo $sql_res1["c_name"]; ?></option> <?php}?> </select>
Muhammad_92 0 Newbie Poster
pritaeas 2,194 ¯\_(ツ)_/¯ Moderator Featured Poster
tanzeel0071 0 Newbie Poster
Lau_1 12 Junior Poster in Training
lps 71 Posting Pro in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.