php - multi-select drop-down results shows Array
im using multi select drop down list im able to select the list i want to update in my database but when i see the results it shows "Array" Instead Of the Selection.
<select class="selectpicker" multiple data-live-search="true" name="Attendedby" ng-model="Attendedby">
<option>Mustard</option>
<option>Ketchup</option>
<option>Relish</option>
</select>
$('select').selectpicker();
i dont know why my results display Array, please help
Here is my php
if($form_data->action == 'Edit')
{
$data = array(
':Attendedby' => $Attendedby,
':EndDate' => $EndDate,
':Status' => $Status,
':Remarks' => $Remarks,
':id' => $form_data->id
);
$query = "
UPDATE cov9
SET Attendedby = :Attendedby, EndDate = :EndDate, Status = :Status, Remarks = :Remarks
WHERE id = :id
";
$statement = $connect->prepare($query);
if($statement->execute($data))
{
$message = 'Data Edited';
}
}
}
Answer
Solution:
First of all you need to edit the name of the select
to Attendedby[]
as it expects multiple values and then use something like this to get multiple data into one column:
$Attendedby = implode(', ', $_POST['Attendedby']);
Source