Sunday 31 July 2016

how to create a dynamic drop-down in wordpress

<?php
global $wpdb;
$select_query= $wpdb->get_results( 'SELECT * FROM wp_add_bed_service');
echo "<select class='form-control' id='badroom-1' name='bedroom'>";
foreach ($select_query as $select_queryy )
{
  echo "<option value='$select_queryy->price' >".htmlspecialchars($select_queryy->bedroom)."</option>";
}
echo "</select>";

?>

No comments:

Post a Comment