this is the output
<?php
include_once('connection.php');
$StdID = $_REQUEST['txtID'];
$StdImage = $_REQUEST['txtImage'];
$FullName = $_REQUEST['txtFullname'];
$Address = $_REQUEST['txtAdd'];
$Bday = $_REQUEST['txtBday'];
$Grade = $_REQUEST['txtGrade'];
$Height = $_REQUEST['txtHeight'];
$Weight = $_REQUEST['txtWeight'];
$BloodPressure = $_REQUEST['txtBlood'];
$Gname = $_REQUEST['txtGname'];
$Contact = $_REQUEST['txtContact'];
$BCG = $_REQUEST['chkBCG'];
$Cardiac = $_REQUEST['chkCardiac'];
$Asthma1 = $_REQUEST['chkAsthma1'];
$Alcohol = $_REQUEST['chkAlcohol'];
$OPV1 = $_REQUEST['chkOpv1'];
$Thyroid = $_REQUEST['chkThyroid'];
$Chicken = $_REQUEST['chkChicken'];
$Tobacco = $_REQUEST['chkYosi'];
$OPV2 = $_REQUEST['chkOPV2'];
$Diabetes = $_REQUEST['chkDiabetes'];
$Measles = $_REQUEST['chkMeasles1'];
$Opv3 = $_REQUEST['chkOpv3'];
$Hypertension = $_REQUEST['chkHypertension'];
$Mumps = $_REQUEST['chkMumps1'];
$Food1 = $_REQUEST['txtFood1'];
$DPT1 = $_REQUEST['chkDpt1'];
$Tuberculosis = $_REQUEST['chkTuber'];
$Ulcer = $_REQUEST['chkUlcer'];
$Food2 = $_REQUEST['txtFood2'];
$DPT2 = $_REQUEST['chkdpt2'];
$Asthma2 = $_REQUEST['chkAsthma2'];
$Dengue = $_REQUEST['chkdengue'];
$Food3 = $_REQUEST['txtfood3'];
$Dpt3 = $_REQUEST['chkDpt3'];
$Kidney = $_REQUEST['chkKidney'];
$Head = $_REQUEST['chkHead'];
$Measles2 = $_REQUEST['chkMeasles2'];
$Cancer = $_REQUEST['chkCancer'];
$Std = $_REQUEST['chkstd'];
$Scar = $_REQUEST['chkScar'];
$Hepa = $_REQUEST['chkHepa'];
$Hypertension2 = $_REQUEST['chkHypertension2'];
$Mole = $_REQUEST['chkMole'];
$Std2 = $_REQUEST['chkStd2'];
$Kidney2 = $_REQUEST['chkKidney2'];
$Tattoo = $_REQUEST['chkTattoo'];
$OthersImmu = $_REQUEST['txtothersimmu'];
$Birthmark = $_REQUEST['txtBirthmark'];
$OthersImmu2 = $_REQUEST['txtothersimmu2'];
$OthersIll = $_REQUEST['txtothersill'];
$OthersImmu3 = $_REQUEST['txtothersimmu3'];
$OthersIll2 = $_REQUEST['txtothersill2'];
$Mens = $_REQUEST['txtmens'];
$sql = "INSERT INTO tbl_medics VALUES ('$StdID', '$StdImage', '$FullName', '$Address', '$Bday', '$Grade', '$Height', '$Weight', '$BloodPressure', '$Gname','$Contact', '$BCG', '$Cardiac', '$Asthma1', '$Alcohol', '$OPV1', '$Thyroid', '$Chicken','$Tobacco', '$OPV2', '$Diabetes', 'Measles', '$Opv3', '$Hypertension', '$Mumps', '$Food1', '$DPT1', '$Tuberculosis', '$Ulcer', '$Food2', '$DPT2', '$Asthma2', '$Dengue', '$Food3', '$Dpt3', '$Kidney', '$Head', '$Measles2', '$Cancer', '$Std', '$Scar', '$Hepa', '$Hypertension2', '$Mole', '$Std2', '$Kidney2', '$Tattoo', '$OthersImmu', '$Birthmark', '$OthersImmu2', '$OthersIll', '$OthersImmu3', '$OthersIll2', '$Mens')";
if ($conn->query($sql) === TRUE) {
header("Location: MedicRecords.php?SuccessfullyAdded");
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
?>
This is my Input
<form action="AddMedicRecords.php" method="POST" enctype="multipart/form-data" style="border:1px solid #ccc">
<?php $id = $_GET['id'];
$sql = "SELECT * FROM tblstdpro where StdID = '$id'";
$result = mysqli_query($conn,$sql);
$count = 0;
while($row = mysqli_fetch_array($result)){
?>
<div class="box-body">
<div class="form-group">
<label><b>Student Image Location</b></label>
<input type="text" class="form-control" value="<?php echo $row['StdImage'];?>" name="txtImage" type="readonly" readonly></br>
<label><b>LRN</b></label>
<input type="text" class="form-control" value="<?php echo $row['StdID'];?>" name="txtID" required></br>
<label><b>Full Name</b></label>
<input type="text" class="form-control" value="<?php echo $row['Lname'];?>, <?php echo $row['Fname'];?> <?php echo $row['Mname'];?>" name="txtfullname" required></br>
<label><b>Address</b></label></br>
<input type="text" class="form-control" value="<?php echo $row['Street']; ?> , <?php echo $row['Barangay']; ?> <?php echo $row['Munic']; ?>, <?php echo $row['Province']; ?>" name="txtadd" required></br>
<label><b>Birthday</b></label>
<input type="text" class="form-control" value="<?php echo $row['Bday'];?>" name="txtbday" required></br>
<label><b>Grade/ Course</b></label></br>
<input type="text" class="form-control" value="<?php echo $row['Track'];?> - <?php echo $row['YearLvl'];?>" name="txtgrade" required></br>
<label><b>Height</b></label>
<input type="" class="form-control" placeholder="Enter Height" name="txtheight" required></br>
<label><b>Weight</b></label>
<input type="" class="form-control" placeholder="Enter Weight" name="txtweight" required></br>
<label><b>Blood Pressure</b></label>
<input type="" class="form-control" placeholder="Enter BP" name="txtblood" required></br>
</br>
<label><b><h3>*Person to be Notified in Case of Emergency</h3></b></label>
</br>
<label><b>Name:</b></label>
<input type="text" class="form-control" value="<?php echo $row['Mother'];?>" name="txtGname" required></br>
<label><b>Contact No.</b></label>
<input type="text" class="form-control" class="form-control" value="<?php echo $row['Contact'];?>" name="txtContact"></br>
<label><h3>*Kindly Check the Box Provided on the Left Side</h3></label>
<table class="table table-hover">
<thead>
<tr>
<th>IMMUNIZATION</th>
<th>FAMILY HISTORY</th>
<th>PREVIOUS ILLNESS</th>
<th>PERSONAL HISTORY</th>
</tr>
</thead>
<tbody>
<tr>
<td><input type="checkbox" name="chkBCG" value="BCG"> BCG</td>
<td><input type="checkbox" name="chkCardiac" value="Cardiac Disease"> Cardiac Disease</td>
<td><input type="checkbox" name="chkAsthma1" value="Asthma"> Asthma</td>
<td><input type="checkbox" name="" value="chkAlcohol"> Alcohol Use</td>
</tr>
<tr>
<td><input type="checkbox" name="chkOpv1" value="OPV 1"> OPV 1</td>
<td><input type="checkbox" name="chkThyroid" value="Thyroid Disease"> Thyroid Disease</td>
<td><input type="checkbox" name="chkChicken" value="Chicken Pox"> Chicken Pox</td>
<td><input type="checkbox" name="chkYosi" value="Tobacco Use"> Tobacco Use</td>
</tr>
<tr>
<td><input type="checkbox" name="chkOpv2" value="OPV 2"> OPV 2</td>
<td><input type="checkbox" name="chkDiabetes" value="Diabetes Mellitus"> Diabetes Mellitus</td>
<td><input type="checkbox" name="chkMeasles1" value="Measles"> Measles</td>
<td>Allergy to Food, Drugs,Etc..</td>
</tr>
<tr>
<td><input type="checkbox" name="chkOpv3" value="OPV 3"> OPV 3</td>
<td><input type="checkbox" name="chkHypertension" value="Hypertension"> Hypertension</td>
<td><input type="checkbox" name="chkMumps" value="Mumps"> Mumps</td>
<td><input type="text" class="form-control" class="form-control" placeholder="Enter Allergy to Food, Drugs,Etc.." name="txtFood1"> </td>
</tr>
<td><input type="checkbox" name="ChkDpt1" value="DPT1"> DPT 1</td>
<td><input type="checkbox" name="chkTuber" value="Tuberculosis"> Tuberculosis</td>
<td><input type="checkbox" name="chkUlcer" value="Peptic Ulcer"> Peptic Ulcer</td>
<td><input type="text" class="form-control" class="form-control" placeholder="Enter Allergy to Food, Drugs,Etc.." name="txtFood2"> </td>
</tr>
<td><input type="checkbox" name="chkDpt2" value="DPT 2"> DPT 2</td>
<td><input type="checkbox" name="chkAstma2" value="Asthma"> Asthma</td>
<td><input type="checkbox" name="chkDengue" value="Dengue"> Dengue</td>
<td><input type="text" class="form-control" class="form-control" placeholder="Enter Allergy to Food, Drugs,Etc.." name="txtFood3"> </td>
</tr>
<tr>
<td><input type="checkbox" name="chkDpt3" value="DPT 3"> DPT 3</td>
<td><input type="checkbox" name="chkKidney" value="Kidney Disease"> Kidney Disease</td>
<td><input type="checkbox" name="chkHead" value="Head Injury"> Head Injury</td>
<td>Any Identification Mark:</td>
</tr>
<tr>
<td><input type="checkbox" name="chkMeasles2" value="Measles"> Measles</td>
<td><input type="checkbox" name="chkCancer" value="Cancer"> Cancer</td>
<td><input type="checkbox" name="chkStd" value="STD"> STD</td>
<td><input type="checkbox" name="chkScar" value="Scar"> 1. Scar</td>
</tr>
<tr>
<td><input type="checkbox" name="chkHepa" value="HEPA-B"> HEPA-B</td>
<td><input type="checkbox" name="chkSkin" value="Skin Disease"> Skin Disease</td>
<td><input type="checkbox" name="chkHypertension2" value="Hypertension"> Hypertension</td>
<td><input type="checkbox" name="chkMole" value="Mole"> 2. Mole</td>
</tr>
<tr>
<td>Others:</td>
<td><input type="checkbox" name="chkStd2" value="STD"> STD</td>
<td><input type="checkbox" name="chkKidney2" value="Kidney Problem"> Kidney Problem</td>
<td><input type="checkbox" name="chkTattoo" value="Tattoo"> 3. Tattoo</td>
</tr>
<tr>
<td><input type="text" class="form-control" class="form-control" placeholder="Enter Others" name="txtOthersImmu"> </td>
<td></td>
<td>Others:</td>
<td><input type="checkbox" name="txtBirthmark" value="Birthmark"> 4. Birthmark</td>
</tr>
<tr>
<td><input type="text" class="form-control" class="form-control" placeholder="Enter Others" name="txtOthersImmu2"> </td>
<td></td>
<td><input type="text" class="form-control" class="form-control" placeholder="Enter Others" name="txtOthersIll"> </td>
<td></td>
</tr>
<tr>
<td><input type="text" class="form-control" class="form-control" placeholder="Enter Others" name="txtOthersImmu3"> </td>
<td></td>
<td><input type="text" class="form-control" class="form-control" placeholder="Enter Others" name="txtOthersIll2"> </td>
<td></td>
</tr>
</tbody>
</table>
<label><b>FOR FEMALE ONLY: Date of Last Menstrual Period:</b></label>
<div class="form-group">
<div class="input-group">
<div class="input-group-addon">
<i class="fa fa-calendar"></i>
</div>
<input type="date" placeholder="Enter Birthday" class="form-control" data-inputmask="'alias': 'mm/dd/yyyy'" data-mask name="txtMens" >
</div>
<!-- /.input group -->
</div>
<!-- /.form group -->
<div class="clearfix">
<button type="submit" name="submit" class="btn btn-block btn-primary btn-lg">Add Student</button>
<button type="button" class="btn btn-block btn-danger btn-lg">Cancel</button>
</form></br></br>
</div>
</form>
<?php
}
?>
Errors Says this
Notice: Undefined index: txtFullname in C:\wamp64\www\TestingThesis\AddMedicRecords.php on line 9
Error: INSERT INTO tbl_medics VALUES ('014-321', 'StdImage/014-321.jpg', '', '', '', '', '', '', '', 'Mommy','097576346', 'BCG', '', '', '', '', '', '','', '', '', 'Measles', '', '', '', '', '', '', '', '', '', '', '', '', '', 'Kidney Disease', '', '', '', '', '', '', '', 'Mole', '', '', '', '', '', '', '', '', '', '')
Data truncated for column 'StdID' at row 1
How can this be done when there are so many uncheck it errors bet when i check it all it goes in, how can i put a default value if it is uncheck?