Vote count:
0
I create a form that contains a button to add a new drop down menu (select) dynamically "I want to insert the value of each select when submitting the form". I could manage to insert the original menu but I could do the same for the others:
Php:
if (isset ($_POST['attendence'])&& $_POST['attendence']!='none'){
for ($i = 0; $i < count($_POST['attendence']); $i++) {
$new_attendence = $_POST['attendence'][$i];
$query = "INSERT INTO `meetingattendance`(`meetingID`, `attendance`) VALUES
(LAST_INSERT_ID(),'$new_attendence')";
mysql_query($query) or die('Error, query failed');
}
}
form:
<div class="more-box">
<select name="attendence[0]" class="att_list long">
<option value="none"></option>
<? echo $Attendence; ?>
</select>
<button class="moreAttendence">more</button>
</div>
this way works great in other scinario that I have done the only difference that it was an input type of text instead of select menu So What did I miss here ?
asked 31 secs ago
How to insert the value of multiple drop-down menus in PHP
Aucun commentaire:
Enregistrer un commentaire