0

Dear Friend,
I create a dropdown list and want to retrieve data(company name list) from MYSQL to this dropdown list ,please, help me.no error but data does not show.
code is bellow

Company Name:          
<?php
include "conn.php";
  $sql="SELECT * FROM login1 ";
  $result=$conn->query($sql);
  echo "<select name=cn value=''>Company Name</option>"; // list box select command
foreach ($conn->query($sql) as $row){//Array or records stored in $row
echo "<option value='$row[id]'></option>";
/* Option values are added by looping through the array */
}
echo "</select>";// Closing of list box <br>
?>     <br>

please help me.

3
Contributors
5
Replies
19
Views
2 Years
Discussion Span
Last Post by zebnoon1
0
  echo "<select name=cn value=''>Company Name</option>"; // list box select command
foreach ($conn->query($sql) as $row){//Array or records stored in $row
echo "<option value='$row[id]'>$row[name]</option>";*/ here put $row[name]
/* Option values are added by looping through the array */
}
This question has already been answered. 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.