list box
Posted: Tue Aug 08, 2006 2:10 am
hi,
this is my coding to add dynamically to a list box
<select name="cboDept" ><? loadDept() ?> </select>
when i do this the list box show the first value always in the text area of the list box even without selecting a value how to get rid from this since, sometimes i do not want to save the value from this list box.
thanks
shiran
this is my coding to add dynamically to a list box
Code: Select all
<?php
function loadDept(){
include('Conn.php');
$sql="Select deptName from tblDepartments order by deptName";
$query=mysql_query($sql) or die ("Deparments can not be loaded.");
while($row=mysql_fetch_assoc($query)){
$arrDeparments[]=$row;
}
foreach ($arrDeparments as $d) echo "<OPTION>{$d['deptName']}</OPTION>\n";
}
?><select name="cboDept" ><? loadDept() ?> </select>
when i do this the list box show the first value always in the text area of the list box even without selecting a value how to get rid from this since, sometimes i do not want to save the value from this list box.
thanks
shiran