i made this form with a Tag Select Option and now i want to add all tags selected in the database:
form.php
<form action="actions/add_band.php" method="POST" class="form-horizontal" />
<div class="control-group">
<label class="control-label">Géneros</label>
<div class="controls">
<select name="generos" data-placeholder="" class="chosen span6" multiple="multiple" tabindex="6" style="width:100%;">
<option value="" />
<optgroup label="">
<option />Dallas Cowboys
<option />New York Giants
<option />Philadelphia Eagles
<option />Washington Redskins
</optgroup>
</select>
</div>
</div>
</form>
add_band.php
if(isset($_POST['submit'])){
$nome = $_POST['nome'];
$generos = $_POST['generos'];
while (list(, $value) = each($generos)) {
echo "Value: $value<br />
";
}
foreach ($generos as $value) {
echo "Value: $value<br />
";
}
die();
}
Everytime i submit it gets me only the first tag selected.
How can i post all tags as an array or any other way easy to then Insert in the database?