我正在开发一个 html 表单,其数据被保存到 MS-SQL 服务器数据库中。我能够将所有其他字段保存到数据库中它们各自的列中,但是复选框字段将值保留为空。我对这个概念不是很熟悉。
这是代码:
表单.php
<form class="cmxform" action ='functions/Form.php' method="post">
<div class="form-row">
<h3> Contact Information</h3>
<div class="form-group col-md-4">
<label for="fName">First Name </label>
<input type="text" class="form-control" id="fName" name="fName">
</div>
<div class="form-group col-md-4">
<label for="lName">Last Name</label>
<input type="text" class="form-control" id="lName" name="lName">
</div>
<div class="form-group col-md-4">
<label for="email">Email </label>
<input type="email" class="form-control" id="email" name="email">
</div>
</div>
<div class="form-group col-md-12">
<h3>Category: Please choose one of the following: </h3>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="defaultCheck1">
<label class="form-check-label" for="defaultCheck1">
Vegetarian
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="defaultCheck1">
<label class="form-check-label" for="defaultCheck1">
Ham
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="defaultCheck1">
<label class="form-check-label" for="defaultCheck1">
Turkey
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="defaultCheck1">
<label class="form-check-label" for="defaultCheck1">
Other
</label>
</div>
这是我在将数据发送到数据库时遇到的唯一问题。休息一切正常。
红糖糍粑
精慕HU