With PHP I echo out a <select> with options to a form based on database values like this:
/* SQL Stuff */
$sql = mysql_query("SELECT id, name FROM myTable");
echo "<select>";
while ($row = mysql_fetch_assoc($sql)) {
echo "<option value='" . $row['id'] . "'>" . $row['name'] . "</option>";
}
echo "</select>";
Is it possible with jQuery to have an "Add" button, which will generate the same <select> with the same <option> values to the form?
You don’t give html in your question. So its not possible to hit to correct point. But I think you need something like following. It is just an sample.
HTML
jQuery