nec9716 Posted April 2, 2008 Share Posted April 2, 2008 ok I have try to cut the script a bit so the dropdown menu work but not showing the right value ( when update is selected ) always the lowest ID is show it might not be readable but I have try to post the full script (400 lignes )...but not much respond...which I understand $result = conn($sql); show_form($result); function show_form($handle='',$data='') //variables $row = mysql_fetch_array($handle); $query6 = "SELECT userid, uname FROM user"; $result6 = mysql_query($query6); $tpname = $row['pname']; $id = $row['id']; //end of variables echo "<input type="hidden" value="' .$row['id'] .'" name="id">"; if(isset($_POST['pname'])) $tpname = $_POST['pname']; else $tpname = 1; echo'<select name="pname" size="1" onchange="setItemListBox()">'; while($row = mysql_fetch_array($result6, MYSQL_NUM)) { if($row[0] == $tpname) echo '<option value="' . $row[0] . '" selected>' . $row[1] . '</option>'; else echo '<option value="' . $row[0] . '">' . $row[1] . '</option>'; } echo '</select>'; echo "</td >"; Link to comment https://forums.phpfreaks.com/topic/99277-trouble-with-dropdown-menu-simplifie/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.