-
chained dropdown from database
over 7 years ago
-
over 7 years ago
Hello Sir,
I just go through your mentioned link. If you want to display username in a dropdown then you need to fetch all usernames from database using SELECT query. Please have a look.
$reference = mysqli_query($conn,"SELECT username from TABLENAME"); $results = mysqli_fetch_array($reference,,MYSQLI_NUM);
You need to replace TABLENAME with your table name. Array results contains all usernames from database. You can list these usernames in dropdown. Please have a look.
<select name="usernames" > <?php foreach($results as $result) { ?> <option value="<?php echo $result; ?>"><?php echo $result; ?></option> <?php } ?> </select>
-
1 Answer(s)