Php 未在数据库中插入下拉列表值

Php 未在数据库中插入下拉列表值,php,html,mysql,Php,Html,Mysql,我有一个下拉列表,其中的值来自一个数组,每当我尝试提交表单时,该值没有被插入到数据库中,我尝试检查所有可能的错误,但没有任何帮助 从中获取值的数组 $available_background_types = ['Color', 'Image', 'Gradient']; 下拉代码 <div class="form-group"> <label>Choose Background</label> <select class="custom-sele

我有一个下拉列表,其中的值来自一个数组,每当我尝试提交表单时,该值没有被插入到数据库中,我尝试检查所有可能的错误,但没有任何帮助

从中获取值的数组

 $available_background_types = ['Color', 'Image', 'Gradient'];
下拉代码

<div class="form-group">
 <label>Choose Background</label>
 <select class="custom-select" name="background_type">
  <?php foreach($available_background_types as $type): ?>
        <option value="<?= $type; ?>" <?php if($user->background_type() == $type) echo 'selected' ?>><?php echo $type; ?></option>
  <?php endforeach; ?>
 </select>
</div>


我试了很多次,数据库中的背景字段仍然是空的。它的数据类型是VarChar。

您是否有一个
带有
method=“post”
的地方?是的,我只是指定了上面没有提到的
if(isset($_POST['submit'){
  $background = $_POST['background_type'];
 if($dbqueries->Query('UPDATE users SET background = ? WHERE id = ?', [$background, $userId])){
        header('Location: ../profile-settings');
        }
}