0

hi all, how do i use a drop down box to show my fields in my sql table ? below is what i have so far, i need to display all of the EmployeeIDs in the drop down box.

<select  name="name">
			   <?php
			   $sqlName="SELECT * FROM employeedetails";
$queryName = mysql_query($sqlName,$connection);
$recordName = mysql_fetch_assoc($queryName);
$EmployeeID=$recordName['EmployeeID'];
echo $recordName['$EmployeeID'];
?>

            </select>
3
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by vibhaJ
0

Try this.

<?php

// your database connection here

echo "<select name='dropdown1'>";
$query = mysql_query("SELECT * from employeedetails");
while($result=mysql_fetch_array($query));
{
echo "<option name='id_list'>".$result['EmployeeID']."</option>";
}

echo "</select>";

?>
0

Also use value in option tag.
Because it may cause issue in IE.

<?php

// your database connection here

echo "<select name='dropdown1'>";
$query = mysql_query("SELECT * from employeedetails");
while($result=mysql_fetch_array($query));
{
echo "<option value='".$result['EmployeeID']."' name='id_list'>".$result['EmployeeID']."</option>";
}

echo "</select>";

?>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.