-1

please help me to populate rows from MySQL to dropdown menu.

$result = R::getCol("SELECT name FROM language");

I see all beans, but how can I put this beans into dropdown menu and can send multiple values to MySQL?

<select name="languages">
?????
</select>

Thanks!

RiggsFolly
  • 93,638
  • 21
  • 103
  • 149

1 Answers1

0

That returns an array of values, so a simple foreach should process that nicely

See The RedBeansPHP Manual

$names = R::getCol("SELECT name FROM language");

echo '<select name="languages">';

foreach( $names as $name ) {
    echo "<option value='$name'>$name</option>";
}

echo '</select>';
RiggsFolly
  • 93,638
  • 21
  • 103
  • 149