I make a form like this
<input type="text" name="id">
<input type="text" name="brand">
and there is a multiple choice select:
<select name="cars" multiple required>
<option value="Avanza">Avanza</option>
<option value="Xenia">Xenia</option>
<option value="Colt">Colt</option>
</select>
after i get selected options, i have to pass them to a table in the database; table consists of 3 columns like this: https://i.stack.imgur.com/bBSIJ.jpg
id, brand and cars. When I choose all of selected options like this : https://i.stack.imgur.com/codXQ.jpg
then I pressed the submit button.
How to transform the data into this : https://i.stack.imgur.com/9ixsY.jpg
Can you help me, please..
this is a query:
$query = "INSERT INTO cars (id, brand,cars) VALUES ('$_POST[id]', '$_POST[brand]','$_POST[cars]')";