I have the following form but i cannot get the SELECT (dropdown menu with multiple choice) value to be added in the database. Where am I wrong? I am using php and I can get all the other value be addedd correctly except the select part. I would like to have a dropdown menu with some choices and when I press "submit" the selected value get into the database.
<form action="post.php" method="post">
<div class="form-group">
<label for="name">Customer Name:</label>
<input type="text" name="name" class="form-control" id="name">
</div>
<div class="form-group">
<label for="email">Email address:</label>
<input type="email" name="email" class="form-control" id="email">
</div>
<div class="form-group">
<label for="number">Mobile Number:</label>
<input type="text" name="number" class="form-control" id="number">
</div>
<div class="form-group">
<label for="price">Price:</label>
<input type="text" name="price" class="form-control" id="price">
</div>
<div class="form-group">
<label for="payment">Payment Type</label>
<input type="text" name="payment" class="form-control" id="payment">
</div>
<div class="form-group">
<label for="device">Device Name:</label>
<input type="text" name="device" class="form-control" id="device">
</div>
<div class="form-group">
<label for="status">Status:</label>
<select name="status[]" multiple class="form-control" id="status">
<option value="New">New</option>
<option value="Green">Progress</option>
<option value="Blue">Wait</option>
<option value="Pink">Done</option>
<option value="Yellow">Close</option>
</select>
</div>
<button type="submit" name="submit" class="btn btn-default">Submit</button>
</form>
and the query:
$sql = "INSERT INTO ... (name, mail, number, device, price, paymenttype,status,date) VALUES ('$name', '$email', '$number', '$device', '$price', '$payment','$status',NOW())";
if(mysqli_query($link, $sql)){
// echo "Records added successfully.";
header("location:....php?message=The customer has been added to the database");
} else{
echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
}