Scroll to top

How to add options in select html tag(Drowdown) from database in wordpress?

add options in select html tag(Drowdown) from database in wordpress

<label>Customer Name</label>
<select>
<?php
global $wpdb;

$result = $wpdb->get_results ( “SELECT * FROM wp_jaspreetsingh ” );
foreach ( $result as $print ) 
{
echo”<option>$print->person_name</option>”;
}
?>
</select>

Leave a Reply

Your email address will not be published.