【发布时间】:2015-11-27 14:52:27
【问题描述】:
我的问题先生/女士在复选框 html-php-mysql 中,如果选中该框,则将保存在 MYSql 中的值为“已完成”,如果未选中该框,则它还将保存该值mysql中的“未完成”,但在我的情况下,即使是检查,它仍然会保存未完成
<h1><span class="label label-primary left">Requirements</span></h1><br><br>
<div class="checkbox ">
<label><input type="checkbox" name="Card" value="Complete">
<input type="hidden" name="Card" value="Not Complete">High School Card (Form 138)</label>
</div> <div class="checkbox b">
<label><input type="checkbox" name="MoralCertificate" value="Complete">
<input type="hidden" name="MoralCertificate" value="Not Complete">
Good Moral Certificate</label>
</div> <div class="checkbox bb">
<label><input type="checkbox" name="BirthCertificate" value="Complete">
<input type="hidden" name="BirthCertificate" value="Not Complete">
NSO Birth Certificate</label>
</div> <div class="checkbox bbb">
<label><input type="checkbox" name="IDPicture" value="Complete">
<input type="hidden" name="IDPicture" value="Not Complete">
2x2 Formal ID Picture</label>
</div> <div class="checkbox bbbb">
<label><input type="checkbox" name="HonorStudents" value="Complete">
<input type="hidden" name="HonorStudents" value="Not Complete">
Certification for Honor Students</label>
</div> <div class="checkbox bbbbb">
<label><input type="checkbox" name="Form137" value="Complete">
<input type="hidden" name="Form137" value="Not Complete">
Form 137</label>
</div>
$Elementary = $_POST['Elementary'];
$YearGraduated = $_POST['YearGraduated'];
$AwardsReceived = $_POST['AwardsReceived'];
$Year = $_POST['Year'];
$Place = $_POST['Place'];
$status = $_POST['Card'];
$MoralCertificate = $_POST['MoralCertificate'];
$BirthCertificate = $_POST['BirthCertificate'];
$IDPicture = $_POST['IDPicture'];
$HonorStudents = $_POST['HonorStudents'];
$Form137 = $_POST['Form137'];
mysqli_query($con,"INSERT INTO educationalbackground (Elementary, YearGraduated, AwardsReceived, Year, Place, Card, MoralCertificate, BirthCertificate, IDPicture, HonorStudents, Form137 )
VALUES ('$Elementary','$YearGraduated', '$AwardsReceived', '$Year', '$Place', '$status', '$MoralCertificate', '$BirthCertificate', '$IDPicture', '$HonorStudents', '$Form137')");
header("Location: ThirdForm.php");
mysqli_close($con);
enter code hereenter image description hereenter image description here
【问题讨论】:
-
看看,没有要修复的代码。
-
我想。你错过了代码。
-
对不起,我是新来的,我发布了图片,我不知道它现在在哪里
-
仍然没有输入,您在哪里检查“先生/女士”这个标签在哪里?
-
为什么不每个字段只有一个复选框,然后测试结果是php就像
if(isset('checkboxname')){ \\completed }else{ \\ not completed }