Fetch data into many dropdown button in wordpress

Try like this:

<?php
global $wpdb;
$result = $wpdb->get_results( "SELECT name FROM student_reg");
echo "<select name='name'>";
foreach ($result as $row) {
   echo "<option value='" . $row->name . "'>" . $row->name . "</option>";
}
echo "</select>";
?>

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top