pontiac007 Posted March 12, 2007 Share Posted March 12, 2007 i attemp to design a drop down menu that call up data from a table for each drop down menu. code: <?php //$query=mysql_query("SELECT acadstaff.idstaff, acadstaff.staffname FROM acadstaff WHERE idstaff='$session[idstaff]'"); $query=mysql_query("SELECT * FROM acadstaff WHERE idstaff='$session[idstaff]'"); echo "<select name='idstaff' onChange='Reload(this.value)'><option value=''>Lecturer..</option>"; while($rs = mysql_fetch_array($query)) { if($rs['idstaff']==@$idstaff) { echo "<option selected value='$rs[idstaff]' >$rs[staffname]</option>"."<BR>"; include "session_start/staff_session.php"; } else { echo "<option value='$rs[idstaff]'>$rs[staffname]</option>"; include "session_start/staff_session.php"; } } echo "</select>"; //echo "<input type=submit value=Borang name=Submit>"; //echo "</form>"; $query=mysql_query("SELECT subject.nmsubj FROM subject WHERE kodsubj='$session[kodsubj]'"); echo "<select name='cat' onChange='Reload(this.value)'><option value=''>Subject..</option>"; while($rs = mysql_fetch_array($query)) { if($rs['kodsubj']==@$kodsubj) { echo "<option selected value='$rs[kodsubj]' >$rs[nmsubj]</option>"."<BR>"; include "session_start/subj_session.php"; } else { echo "<option value='$rs[kodsubj]'>$rs[nmsubj]</option>"; include "session_start/subj_session.php"; } } echo "</select>"; echo "<input type=submit value=EVALUATE name=Submit>"; echo "</form>"; ?> not only that i failed. the data doesn't even appear in the list. worst, the submit button, pointed straght to the wrong link page link code: <form name="form1" method="post" action="http://localhost/dcs/stud.php"> wat can i do? noted that i'm new in php Link to comment https://forums.phpfreaks.com/topic/42325-help-with-multiple-dropdown-menu/ Share on other sites More sharing options...
tauchai83 Posted March 12, 2007 Share Posted March 12, 2007 well, looking at the form name etc, it seems you are from MAS or IND. include "session_start/subj_session.php"; mind to show this file coding as well? boleh ke dok? Link to comment https://forums.phpfreaks.com/topic/42325-help-with-multiple-dropdown-menu/#findComment-205368 Share on other sites More sharing options...
tauchai83 Posted March 12, 2007 Share Posted March 12, 2007 <?php //mu cuba yang ni. while(list($apax2_variable)=mysql_fetch_array($sql)) ?> list tu cuba list out sumer data dlm db Link to comment https://forums.phpfreaks.com/topic/42325-help-with-multiple-dropdown-menu/#findComment-205373 Share on other sites More sharing options...
pontiac007 Posted March 12, 2007 Author Share Posted March 12, 2007 da cube, xleh gk. ni code utk session_start/subj_session: code: <?php $session['idk']=session_id(); $session['kodsubj']=@$kodsubj;//bile aku cube buang symbol '@', kodsubj undefine, bile letk balik teros ok... ?> aku cube letak pon xleh gk. code: <?php //$query=mysql_query("SELECT acadstaff.idstaff, acadstaff.staffname FROM acadstaff WHERE idstaff='$session[idstaff]'"); $query=mysql_query("SELECT * FROM acadstaff WHERE idstaff='$session[idstaff]'"); echo "<select name='idstaff' onChange='Reload(this.value)'><option value=''>Lecturer..</option>"; while(list($rs)=mysql_fetch_array($sql))//while($rs = mysql_fetch_array($query)) { if($rs['idstaff']==@$idstaff) { echo "<option selected value='$rs[idstaff]' >$rs[staffname]</option>"."<BR>"; include "session_start/staff_session.php"; } else { echo "<option value='$rs[idstaff]'>$rs[staffname]</option>"; include "session_start/staff_session.php"; } } echo "</select>"; : : : : ?> idea lain? lagi satu, knp ade error "Table 'tesco.assessment' doesn't exist"? db aku: tesco table (table ni mmg ade: assessment) Link to comment https://forums.phpfreaks.com/topic/42325-help-with-multiple-dropdown-menu/#findComment-205564 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.