karyoker Posted April 1, 2007 Share Posted April 1, 2007 Another little bug driving me up the wall... With this code it doesnt echo hardware.. Im putting in another drop down "category"and it doesnt print "category" but it does do the drop down.. Also if I put in a submit button what would the if code be to redirect in a tree fashion according to the selection? <?PHP print " Department: <select name=\"deptID\" size=\"1\">"; $query = "SELECT id, name FROM _departments"; $result = mysql_query($query); while(list($id, $name)= mysql_fetch_row($result)) { echo '<option value=\" . $id . \" selected="selected">' . $name . '</option><br>' . chr(10); } echo "hardware"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/45195-solved-echo-echo-data-base-array/ Share on other sites More sharing options...
spfoonnewb Posted April 1, 2007 Share Posted April 1, 2007 <?php echo "Department: <select name=\"deptID\" size=\"1\">"; $result = mysql_query("SELECT id, name FROM _departments"); while(list($id, $name)= mysql_fetch_row($result)) { echo '<option value="'. $id . '" selected="selected">' . $name . '</option>' . chr(10); } echo "</select>"; echo " hardware"; ?> Result: Department: <select name="deptID" size="1"><option value="1" selected="selected">Test 1</option> <option value="2" selected="selected">Test 2</option> </select> hardware Quote Link to comment https://forums.phpfreaks.com/topic/45195-solved-echo-echo-data-base-array/#findComment-219419 Share on other sites More sharing options...
karyoker Posted April 1, 2007 Author Share Posted April 1, 2007 Oh for pete's sakes...Sometimes ya cant see the forest for the trees.... THANKS.... Quote Link to comment https://forums.phpfreaks.com/topic/45195-solved-echo-echo-data-base-array/#findComment-219445 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.