Add Record Add New Record Last Name First Name Middle Name Age Gender Male Female Birthday Address Category Date of First Dose Date of Second Dose ".$row['name']." "; } ?> Can't Insert Data : " .mysqli_error()); } $vaccineval = $_POST['chk']; $date = date('Y-m-d'); for($i=0; $ialert('Add New Record..!!');window.location='parentindex.php'"; } ?> Hello can you help from the code above I see this particular checkbox with BCG in it and I want to delete it but I cant find where it is. I provide the image below it is encircle in red.
<?php
session_start();
?>
<!DOCTYPE html>
<html>
<head>
<title>Add Record</title>
</head>
<style>
body{
background-repeat:no-repeat;
background: url('childback.jpg');
}
.text{
background-color:#c2d6d6;
border:none;
padding:9px 10px;
}
.container {
position:absolute;
margin: 22px 50px 50px 40px;
padding: 25px;
background-color: white;
font-family:Century Gothic;
}
select{
width: 200px;
height: 30px;
}
input[type='submit']{
width:100px;
height:35px;
border-radius:50px 50px 50px 50px;
}
</style>
<body>
<form method="POST" class="container" action="<?php $_SERVER['PHP_SELF'] ?>">
<div style="padding:20;font-size:20">
<a href="parentindex.php"><img src="backarrow.png" width="30" height="30"></a>
<center><h1 >Add New Record</h1></center>
<label><b>Last Name</b></label></br>
<input type="text" name="cname" class="text" placeholder="Enter Last Name" size="70" required /></br></br>
<label><b>First Name</b></label></br>
<input type="text" name="cname" class="text" placeholder="Enter First Name" size="70" required /></br></br>
<label><b>Middle Name</b></label></br>
<input type="text" name="cname" class="text" placeholder="Enter Middle Name" size="70" required /></br></br>
<label><b>Age</b></label>
<input type="number" name="cage" class="text" placeholder="Enter Age" size="40" required /></br></br>
<label><b>Gender</b></label></br>
<input type="radio" name="cgender" value="Male" required />Male
<input type="radio" name="cgender" value="Female" required />Female
</br></br>
<label ><b>Birthday</b></label></br>
<input type="date" name="cbirth" required />
</br></br>
<label ><b>Address</b></label></br>
<input type="text" name="ccity" class="text" placeholder="Enter Address" size="70" required /></br></br>
<label ><b>Category</b></label></br>
<select name="ccity">
<option value="none" selected disabled hidden> Select a category</option>
<option value="Moderna">Moderna</option>
<option value="Pfizer">Pfizer</option>
<option value="Sinovac">Sinovac</option>
<option value="Johnson&Johnson">Johnson&Johnson</option>
<option value="">Vapi</option>
</select>
</br></br>
<label ><b>Date of First Dose</b></label></br>
<input type="date" name="cbirth" required />
</br></br>
<label ><b>Date of Second Dose</b></label></br>
<input type="date" name="cbirth" />
</br></br>
<?php
include 'database_connection.php';
$query="SELECT * FROM vaccine";
$result=mysqli_query($con,$query);
while ($row = mysqli_fetch_array($result))
{
echo "<table>
<tr>
<td><input type='checkbox' name='chk[]' value='".$row['name']."' />".$row['name']."</td>
</tr>
</table>";
}
?>
<br>
<center><input type="Submit" name="addchild" value="Save Record"/></center>
</div>
<?php
if(isset($_POST['addchild']))
{
$con=mysqli_connect("localhost","root","","e_vaccination");
$name = $_POST['cname'];
$gen = $_POST['cgender'];
$city = $_POST['ccity'];
$birth = $_POST['cbirth'];
$age = $_POST['cage'];
$weight = $_POST['cweight'];
$height = $_POST['cheight'];
$chkval = implode(',',$_POST['chk']);
$p_username = $_SESSION['username'];
$query="INSERT INTO child VALUES('$name','$gen','$city','$birth',$age,$weight,$height,'$chkval','$p_username')";
$result=mysqli_query($con,$query);
if(!$result)
{
die("<br>Can't Insert Data : " .mysqli_error());
}
$vaccineval = $_POST['chk'];
$date = date('Y-m-d');
for($i=0; $i<count($vaccineval); $i++)
{
$query_vaccine = "SELECT * FROM vaccine ";
$result_vaccine = mysqli_query($con,$query_vaccine);
while($row_vaccine = mysqli_fetch_array($result_vaccine))
{
if($vaccineval[$i] == $row_vaccine['name'])
{
$time = strtotime($date);
$final = date("Y-m-d", strtotime($row_vaccine['timing'], $time));
$query_date = "INSERT INTO vaccine_dates VALUES('$vaccineval[$i]','$date','$final','$name','$p_username','false')";
$result = mysqli_query($con,$query_date);
if(! $result)
{
die('Could not insert Records: ' . mysql_error());
}
}
}
}
echo "<script>alert('Add New Record..!!');window.location='parentindex.php'</script>";
}
?>
</body>
</html>
Hello can you help from the code above I see this particular checkbox with BCG in it and I want to delete it but I cant find where it is. I provide the image below it is encircle in red.
Step by step
Solved in 3 steps with 1 images