<?php include ('header1f.php');?>
<?php 
ob_start();   
session_start();
include ('connection.php') ;

  if (!isset($_SESSION['is_logged_in'])) {
    header("Location:login.php");
    die();
    }
	date_default_timezone_set('Asia/Calcutta');
$today = date("d/m/Y");
$today3 = date("Y-m-d");
$today1 = date("d/m");

$queryls1 = "select * from  case_study  where case_id='".$_REQUEST['case_id']."'";
$resultls1  = mysqli_query($conn,$queryls1);	
while($row=mysqli_fetch_array($resultls1))
{
$form_date = $row['form_date'];
$first_name = $row['first_name'];
$last_name = $row['last_name'];
$mobile_no = $row['mobile_no'];
$birth_date = $row['birth_date'];
$aadhar_no = $row['aadhar_no'];
$child_height_inch = $row['child_height_inch'];
$child_height_cm = $row['child_height_cm'];
$child_weight_kg = $row['child_weight_kg'];
$email = $row['email'];
$occupation = $row['occupation'];
$address1 = $row['address1'];
$address2 = $row['address2'];
$city = $row['city'];
$state = $row['state'];
$zipcode = $row['zipcode'];
$chief_complaints = $row['chief_complaints'];
$past_history = $row['past_history'];
$medical_report = $row['medical_report'];
$father_past_history = $row['father_past_history'];
$Gfather_past_history = $row['Gfather_past_history'];
$GMfather_past_history = $row['GMfather_past_history'];
$mother_past_history = $row['mother_past_history'];
$Gmother_past_history = $row['Gmother_past_history'];
$GMmother_past_history = $row['GMmother_past_history'];
$developmental_history = $row['developmental_history'];
$menses = $row['menses'];
$leucorrhoea = $row['leucorrhoea'];
$addiction = $row['addiction'];
$water_thirst = $row['water_thirst'];
$desire = $row['desire'];
$aversion = $row['aversion'];
$appetite = $row['appetite'];
$stool = $row['stool'];
$urine = $row['urine'];
$sleep = $row['sleep'];
$perspiration = $row['perspiration'];
$Rheatandcold = $row['Rheatandcold'];
$mind = $row['mind'];
$memory = $row['memory'];
$anxiety = $row['anxiety'];
$like_dislike = $row['like_dislike'];
$your_nature = $row['your_nature'];
$fear_of = $row['fear_of'];
$medical_report1 = $row['medical_report1'];
$term_condition = $row['term_condition'];
$appointment = $row['appointment'];
$case_id = $row['case_id'];

$father_ht_cm = $row['father_ht_cm'];
$mother_ht_cm = $row['mother_ht_cm'];
$siblings_ht_cm = $row['siblings_ht_cm'];
}

?> 
<div class="content-page">
    <div class="content">
      <div class="container">
	  	  
        
        <div class="row">
          <div class="col-sm-12">
            <div class="panel panel-primary">
              <div class="panel-heading">
                <h3 class="panel-title">Case Study <?php echo $first_name?> 
				<button type="button" style="float:right" class="btn btn-danger  waves-effect waves-light" onclick="window.open('prescription_gw.php?case_id=<?php echo $case_id?>&&appointment=<?php echo $appointment?>&&tablename=height_Increasing_program&&program_id=<?php echo $_REQUEST['program_id']?>&&program_name=<?php echo $_REQUEST['program_name']?>&&registration_id=<?php echo $_REQUEST['registration_id']?>', '_blank')">ADD PRESCRIPTION </button></h3>
              </div>
              <div class="panel-body">
			  <div class="col-sm-3 col-xs-12">
                  <div class="form-group">
                    <label>Date</label>
                    
                      <input type="text" class="form-control" value="<?php echo $form_date?>" name="form_date">
                    </div>
                  </div>
				  
				 <div class="col-sm-3 col-xs-12">
                  <div class="form-group">
                    <label>First Name</label>
                    
                      <input type="text" class="form-control" value="<?php echo $first_name?>" name="first_name">
                    </div>
                  </div>
				  
				  
				 <div class="col-sm-3 col-xs-12">
                  <div class="form-group">
                    <label>Last Name</label>
                    
                      <input type="text" class="form-control" value="<?php echo $last_name?>" name="last_name">
                    </div>
                  </div>
				  
				  
				 <div class="col-sm-3 col-xs-12">
                  <div class="form-group">
                    <label>Mobile No</label>
                    
                      <input type="text" class="form-control" value="<?php echo $mobile_no?>" name="mobile_no">
                    </div>
                  </div>
				  
				 <div class="col-sm-3 col-xs-12">
                  <div class="form-group">
                    <label>Birth Date</label>
                    
                      <input type="text" class="form-control" value="<?php echo $birth_date?>" name="birth_date">
                    </div>
                  </div>
				  
				  
				 <div class="col-sm-3 col-xs-12">
                  <div class="form-group">
                    <label>Aadhar No.</label>
                    
                      <input type="text" class="form-control" value="<?php echo $aadhar_no?>" name="aadhar_no">
                    </div>
                  </div>
				  
				  
				 <div class="col-sm-3 col-xs-12">
                  <div class="form-group">
                    <label>Height (In Feet / Inches)</label>
                    
                      <input type="text" class="form-control" value="<?php echo $child_height_inch?>" name="child_height_inch">
                    </div>
                  </div>
				  
				 <div class="col-sm-3 col-xs-12">
                  <div class="form-group">
                    <label>Height (In Cm )</label>
                    
                      <input type="text" class="form-control" value="<?php echo $child_height_cm?>" name="child_height_cm">
                    </div>
                  </div>
				  
				 <div class="col-sm-3 col-xs-12">
                  <div class="form-group">
                    <label>Weight in Kg.</label>
                    
                      <input type="text" class="form-control" value="<?php echo $child_weight_kg?>" name="child_weight_kg">
                    </div>
                  </div>
				  
				  
				 <div class="col-sm-3 col-xs-12">
                  <div class="form-group">
                    <label>Email</label>
                    
                      <input type="text" class="form-control" value="<?php echo $email?>" name="email">
                    </div>
                  </div>
				  
				 <div class="col-sm-3 col-xs-12">
                  <div class="form-group">
                    <label>Occupation</label>
                    
                      <input type="text" class="form-control" value="<?php echo $occupation?>" name="occupation">
                    </div>
                  </div>
				  
				 <div class="col-sm-3 col-xs-12">
                  <div class="form-group">
                    <label>Street Address</label>
                    
                      <input type="text" class="form-control" value="<?php echo $address1?>" name="address1">
                    </div>
                  </div>
				  
				  
				 <div class="col-sm-3 col-xs-12">
                  <div class="form-group">
                    <label>Street Address Line 2</label>
                    
                      <input type="text" class="form-control" value="<?php echo $address2?>" name="address2">
                    </div>
                  </div>
				  
				 <div class="col-sm-3 col-xs-12">
                  <div class="form-group">
                    <label>City</label>
                    
                      <input type="text" class="form-control" value="<?php echo $city?>" name="city">
                    </div>
                  </div>
				  
				 <div class="col-sm-3 col-xs-12">
                  <div class="form-group">
                    <label>State / Province</label>
                    
                      <input type="text" class="form-control" value="<?php echo $state?>" name="state">
                    </div>
                  </div>
				  
				 <div class="col-sm-3 col-xs-12">
                  <div class="form-group">
                    <label>Postal / Zip Code</label>
                    
                      <input type="text" class="form-control" value="<?php echo $zipcode?>" name="zipcode">
                    </div>
                  </div>
				  
				 <div class="col-sm-3 col-xs-12">
                  <div class="form-group">
                    <label>Chief Complaints</label>
                    
                      <input type="text" class="form-control" value="<?php echo $chief_complaints?>" name="chief_complaints">
                    </div>
                  </div>
				  
				 <div class="col-sm-3 col-xs-12">
                  <div class="form-group">
                    <label>Father's Ht (In Cm)</label>
                    
                      <input type="text" class="form-control" value="<?php echo $father_ht_cm?>" name="father_ht_cm">
                    </div>
                  </div>
				  
				 <div class="col-sm-3 col-xs-12">
                  <div class="form-group">
                    <label>Mother's Ht (In Cm)</label>
                    
                      <input type="text" class="form-control" value="<?php echo $mother_ht_cm?>" name="mother_ht_cm">
                    </div>
                  </div>
				  
				  <div class="col-sm-3 col-xs-12">
                  <div class="form-group">
                    <label>Siblings Ht (In Cm)</label>
                    
                      <input type="text" class="form-control" value="<?php echo $siblings_ht_cm?>" name="siblings_ht_cm">
                    </div>
                  </div>
                                  
				  <div class="col-sm-6 col-xs-12">
				    <div class="form-group">
                    <label>Upload Report</label>
                   
                    <?php $ext = pathinfo($medical_report1, PATHINFO_EXTENSION);?>
														<?php if($ext=='pdf'){?>
									<embed src="../medical_report/<?php echo $medical_report1; ?>" width="300" height="300"><?php }else{?>
									<img src="../medical_report/<?php echo $medical_report1;?>" width="300" height="auto"/><?php }?>
                    </div>
                  </div>
				  <div class="col-sm-6 col-xs-12">
				    <div class="form-group">
                    <label>Upload Report</label>
                  
                    <?php $ext = pathinfo($medical_report, PATHINFO_EXTENSION);?>
														<?php if($ext=='pdf'){?>
									<embed src="../medical_report/<?php echo $medical_report; ?>" width="300" height="300"><?php }else{?>
									<img src="../medical_report/<?php echo $medical_report;?>" width="300" height="auto"/><?php }?>
                    </div>
                  </div>
				  <form class="form-horizontal" role="form">

				  <!------------>
                      <div class="form-group">
                    <label class="col-sm-2 control-label">Past History of Any Disease:*</label>
                    <div class="col-sm-10">
					
<?php
$conditions = array(
    "Measles",
    "Mumps",
    "Chickenpox",
    "Chicken Gunia",
    "Maleria",
    "Jaundice",
    "Typhoid",
    "Renal Stone",
    "Gall Stone",
    "Heart-Attack",
    "Piles"
);

// Initialize an array to store checkbox states
$checkbox_states = array();

// Loop through each condition
foreach ($conditions as $condition) {
    // Query to count occurrences of the condition
	
    $query = "SELECT COUNT(*) AS count FROM case_study WHERE past_history like '%$condition%' and  case_id='".$_REQUEST['case_id']."' ";
    $result = mysqli_query($conn, $query);
    $row = mysqli_fetch_assoc($result);
    
    // Determine if the checkbox should be checked
    $is_checked = ($row['count'] > 0) ? 'checked' : '';
    
    // Store the checkbox state for this condition
    $checkbox_states[$condition] = $is_checked;

;?>		
               <div class="checkbox checkbox-success checkbox-inline">
<input type="checkbox" id="inlineCheckbox1" name="past_history[]" value="<?php echo $condition?>" <?php echo $is_checked; ?>>
    <label for="inlineCheckbox1"> <?php echo $condition?> </label>
</div>
<?php } ?>
				
				
				</div>
                  </div>
				  
				    <!------------>
					
					
					
					 <!------------>
                      <div class="form-group">
                    <label class="col-sm-2 control-label">Father</label>
                    <div class="col-sm-10">
<?php 
$conditions = array(
    "Short stature",
    "High Blood pressure",
    "Diabetes",
    "Heart-attack",
    "Cancer",
    "Skin Disease",
    "Obesity"
);

// Initialize an array to store checkbox states
$checkbox_states = array();

// Loop through each condition
foreach ($conditions as $condition) {
    // Query to count occurrences of the condition
    $query = "SELECT COUNT(*) AS count FROM case_study WHERE father_past_history LIKE '%$condition%' AND case_id='".$_REQUEST['case_id']."'";
    $result = mysqli_query($conn, $query);
    $row = mysqli_fetch_assoc($result);

    // Determine if the checkbox should be checked
    $is_checked = ($row['count'] > 0) ? 'checked' : '';

    // Store the checkbox state for this condition
    $checkbox_states[$condition] = $is_checked;
}

// Query to fetch distinct values not present in the $conditions array
$query = "SELECT DISTINCT father_past_history FROM case_study WHERE case_id='".$_REQUEST['case_id']."'";
$result = mysqli_query($conn, $query);
while ($row = mysqli_fetch_assoc($result)) {
    $value = $row['father_past_history'];
    // Check if the value is not in the $conditions array
    if (!in_array($value, $conditions)) {
        // Query to count occurrences of this value
        $query_count = "SELECT COUNT(*) AS count FROM case_study WHERE father_past_history LIKE '%$value%' AND case_id='".$_REQUEST['case_id']."'";
        $result_count = mysqli_query($conn, $query_count);
        $row_count = mysqli_fetch_assoc($result_count);
        // Determine if the checkbox should be checked
        $is_checked = ($row_count['count'] > 0) ? 'checked' : '';
		
        // Store the checkbox state for this value
        $checkbox_states[$value] = $is_checked;
		$parts = explode(",", $value);
		$part = end($parts);
    }
}

// Output the checkbox states
foreach ($checkbox_states as $condition => $is_checked) {?>

 <div class="checkbox checkbox-success checkbox-inline">
 <input type="checkbox" id="inlineCheckbox1" name="Gfather_past_history[]" value="<?php echo $condition?>" <?php echo $is_checked; ?>>
    <label for="inlineCheckbox1"> <?php echo $condition?> </label>
 </div><?php 
}?>






				
				
				
				</div>
                  </div>
				  
				    <!------------>
					
					
					
					 <!------------>
                      <div class="form-group">
                    <label class="col-sm-2 control-label">Paternal Grand Father</label>
                    <div class="col-sm-10">
					
          <?php
$conditions = array(
     "Short stature",
    "High Blood pressure",
    "Diabetes",
    "Heart-attack",
    "Cancer",
    "Skin Disease",
    "Obesity"
);

// Initialize an array to store checkbox states
$checkbox_states = array();

// Loop through each condition
foreach ($conditions as $condition) {
    // Query to count occurrences of the condition
	
    $query = "SELECT COUNT(*) AS count FROM case_study WHERE Gfather_past_history like '%$condition%' and  case_id='".$_REQUEST['case_id']."'";
    $result = mysqli_query($conn, $query);
    $row = mysqli_fetch_assoc($result);
    
    // Determine if the checkbox should be checked
    $is_checked = ($row['count'] > 0) ? 'checked' : '';
    
    // Store the checkbox state for this condition
    $checkbox_states[$condition] = $is_checked;

;?>		
               <div class="checkbox checkbox-success checkbox-inline">
<input type="checkbox" id="inlineCheckbox1" name="Gfather_past_history[]" value="<?php echo $condition?>" <?php echo $is_checked; ?>>
    <label for="inlineCheckbox1"> <?php echo $condition?> </label>
</div>
<?php } ?>

				
				
				
				</div>
                  </div>
				  
				    <!------------>
					
					
					
					
					 <!------------>
                      <div class="form-group">
                    <label class="col-sm-2 control-label">Paternal Grand Mother</label>
                    <div class="col-sm-10">
					
             <?php
$conditions = array(
     "Short stature",
    "High Blood pressure",
    "Diabetes",
    "Heart-attack",
    "Cancer",
    "Skin Disease",
    "Obesity"
);

// Initialize an array to store checkbox states
$checkbox_states = array();

// Loop through each condition
foreach ($conditions as $condition) {
    // Query to count occurrences of the condition
	
    $query = "SELECT COUNT(*) AS count FROM case_study WHERE GMfather_past_history like '%$condition%' and  case_id='".$_REQUEST['case_id']."'";
    $result = mysqli_query($conn, $query);
    $row = mysqli_fetch_assoc($result);
    
    // Determine if the checkbox should be checked
    $is_checked = ($row['count'] > 0) ? 'checked' : '';
    
    // Store the checkbox state for this condition
    $checkbox_states[$condition] = $is_checked;

;?>		
               <div class="checkbox checkbox-success checkbox-inline">
<input type="checkbox" id="inlineCheckbox1" name="GMfather_past_history[]" value="<?php echo $condition?>" <?php echo $is_checked; ?>>
    <label for="inlineCheckbox1"> <?php echo $condition?> </label>
</div>
<?php } ?>
				
				
				
				</div>
                  </div>
				  
				    <!------------>
					
					
					
					
					 <!------------>
                      <div class="form-group">
                    <label class="col-sm-2 control-label">Mother</label>
                    <div class="col-sm-10">
					
         <?php
$conditions = array(
     "Short stature",
    "High Blood pressure",
    "Diabetes",
    "Heart-attack",
    "Cancer",
    "Skin Disease",
    "Obesity"
);

// Initialize an array to store checkbox states
$checkbox_states = array();

// Loop through each condition
foreach ($conditions as $condition) {
    // Query to count occurrences of the condition
	
    $query = "SELECT COUNT(*) AS count FROM case_study WHERE mother_past_history like '%$condition%' and  case_id='".$_REQUEST['case_id']."'";
    $result = mysqli_query($conn, $query);
    $row = mysqli_fetch_assoc($result);
    
    // Determine if the checkbox should be checked
    $is_checked = ($row['count'] > 0) ? 'checked' : '';
    
    // Store the checkbox state for this condition
    $checkbox_states[$condition] = $is_checked;

;?>		
               <div class="checkbox checkbox-success checkbox-inline">
<input type="checkbox" id="inlineCheckbox1" name="mother_past_history[]" value="<?php echo $condition?>" <?php echo $is_checked; ?>>
    <label for="inlineCheckbox1"> <?php echo $condition?> </label>
</div>
<?php } ?>

				
				
				
				</div>
                  </div>
				  
				    <!------------>
					
					
					 <!------------>
                      <div class="form-group">
                    <label class="col-sm-2 control-label">Maternal Grand Father</label>
                    <div class="col-sm-10">
					
             <?php
$conditions = array(
     "Short stature",
    "High Blood pressure",
    "Diabetes",
    "Heart-attack",
    "Cancer",
    "Skin Disease",
    "Obesity"
);

// Initialize an array to store checkbox states
$checkbox_states = array();

// Loop through each condition
foreach ($conditions as $condition) {
    // Query to count occurrences of the condition
	
    $query = "SELECT COUNT(*) AS count FROM case_study WHERE Gmother_past_history like '%$condition%' and  case_id='".$_REQUEST['case_id']."'";
    $result = mysqli_query($conn, $query);
    $row = mysqli_fetch_assoc($result);
    
    // Determine if the checkbox should be checked
    $is_checked = ($row['count'] > 0) ? 'checked' : '';
    
    // Store the checkbox state for this condition
    $checkbox_states[$condition] = $is_checked;

;?>		
               <div class="checkbox checkbox-success checkbox-inline">
<input type="checkbox" id="inlineCheckbox1" name="Gmother_past_history[]" value="<?php echo $condition?>" <?php echo $is_checked; ?>>
    <label for="inlineCheckbox1"> <?php echo $condition?> </label>
</div>
<?php } ?>
				
				
				
				</div>
                  </div>
				  
				    <!------------>
					
					
					
					 <!------------>
                      <div class="form-group">
                    <label class="col-sm-2 control-label">Maternal Grand Mother</label>
                    <div class="col-sm-10">
					
         <?php
$conditions = array(
     "Short stature",
    "High Blood pressure",
    "Diabetes",
    "Heart-attack",
    "Cancer",
    "Skin Disease",
    "Obesity"
);

// Initialize an array to store checkbox states
$checkbox_states = array();

// Loop through each condition
foreach ($conditions as $condition) {
    // Query to count occurrences of the condition
	
    $query = "SELECT COUNT(*) AS count FROM case_study WHERE GMmother_past_history like '%$condition%' and  case_id='".$_REQUEST['case_id']."'";
    $result = mysqli_query($conn, $query);
    $row = mysqli_fetch_assoc($result);
    
    // Determine if the checkbox should be checked
    $is_checked = ($row['count'] > 0) ? 'checked' : '';
    
    // Store the checkbox state for this condition
    $checkbox_states[$condition] = $is_checked;

;?>		
               <div class="checkbox checkbox-success checkbox-inline">
<input type="checkbox" id="inlineCheckbox1" name="GMmother_past_history[]" value="<?php echo $condition?>" <?php echo $is_checked; ?>>
    <label for="inlineCheckbox1"> <?php echo $condition?> </label>
</div>
<?php } ?>
				
				
				
				</div>
                  </div>
				  
				    <!------------>
					
					
					
					 <!------------>
                      <div class="form-group">
                    <label class="col-sm-2 control-label">Developmental History in case of Children</label>
                    <div class="col-sm-10">
					
                  <?php
$conditions = array(
    "Milestone Normal",
    "Late learning to Walk",
    "Late learning to Talk"
);

// Initialize an array to store checkbox states
$checkbox_states = array();

// Loop through each condition
foreach ($conditions as $condition) {
    // Query to count occurrences of the condition
	
    $query = "SELECT COUNT(*) AS count FROM case_study WHERE developmental_history like '%$condition%' and  case_id='".$_REQUEST['case_id']."'";
    $result = mysqli_query($conn, $query);
    $row = mysqli_fetch_assoc($result);
    
    // Determine if the checkbox should be checked
    $is_checked = ($row['count'] > 0) ? 'checked' : '';
    
    // Store the checkbox state for this condition
    $checkbox_states[$condition] = $is_checked;

;?>		
               <div class="checkbox checkbox-success checkbox-inline">
<input type="checkbox" id="inlineCheckbox1" name="developmental_history[]" value="<?php echo $condition?>" <?php echo $is_checked; ?>>
    <label for="inlineCheckbox1"> <?php echo $condition?> </label>
</div>
<?php } ?>
				
				</div>
                  </div>
				  
				    <!------------>
					
				<!------------>
                      <div class="form-group">
                    <label class="col-sm-2 control-label">Menses</label>
                    <div class="col-sm-10">
					
               <?php
$conditions = array(
   "Regular",
    "Irregular",
    "Profuse with Clots",
    "Absent"
);

// Initialize an array to store checkbox states
$checkbox_states = array();

// Loop through each condition
foreach ($conditions as $condition) {
    // Query to count occurrences of the condition
	
    $query = "SELECT COUNT(*) AS count FROM case_study WHERE menses like '%$condition%' and  case_id='".$_REQUEST['case_id']."'";
    $result = mysqli_query($conn, $query);
    $row = mysqli_fetch_assoc($result);
    
    // Determine if the checkbox should be checked
    $is_checked = ($row['count'] > 0) ? 'checked' : '';
    
    // Store the checkbox state for this condition
    $checkbox_states[$condition] = $is_checked;

;?>		
               <div class="checkbox checkbox-success checkbox-inline">
<input type="checkbox" id="inlineCheckbox1" name="menses[]" value="<?php echo $condition?>" <?php echo $is_checked; ?>>
    <label for="inlineCheckbox1"> <?php echo $condition?> </label>
</div>
<?php } ?>
				
				</div>
                  </div>
				  
				    <!------------>
					
					<!------------>
                      <div class="form-group">
                    <label class="col-sm-2 control-label">Leucorrhoea</label>
                    <div class="col-sm-10">
					
                  <?php
$conditions = array(
  "YES",
    "NO",
    "White",
    "Yellowish",
    "Greenish",
    "Offensive Smell"
);

// Initialize an array to store checkbox states
$checkbox_states = array();

// Loop through each condition
foreach ($conditions as $condition) {
    // Query to count occurrences of the condition
	
    $query = "SELECT COUNT(*) AS count FROM case_study WHERE leucorrhoea like '%$condition%' and  case_id='".$_REQUEST['case_id']."'";
    $result = mysqli_query($conn, $query);
    $row = mysqli_fetch_assoc($result);
    
    // Determine if the checkbox should be checked
    $is_checked = ($row['count'] > 0) ? 'checked' : '';
    
    // Store the checkbox state for this condition
    $checkbox_states[$condition] = $is_checked;

;?>		
               <div class="checkbox checkbox-success checkbox-inline">
<input type="checkbox" id="inlineCheckbox1" name="leucorrhoea[]" value="<?php echo $condition?>" <?php echo $is_checked; ?>>
    <label for="inlineCheckbox1"> <?php echo $condition?> </label>
</div>
<?php } ?>

				
				</div>
                  </div>
				  
				    <!------------>
                      <div class="form-group">
                    <label class="col-sm-2 control-label">Addiction</label>
                    <div class="col-sm-10">
					
                  <?php
$conditions = array(
  "Alcohol",
    "Tobacco",
    "Smoking",
    "Gutka",
    "Tea",
    "Coffee",
    "Drugs"
);

// Initialize an array to store checkbox states
$checkbox_states = array();

// Loop through each condition
foreach ($conditions as $condition) {
    // Query to count occurrences of the condition
	
    $query = "SELECT COUNT(*) AS count FROM case_study WHERE addiction like '%$condition%' and  case_id='".$_REQUEST['case_id']."'";
    $result = mysqli_query($conn, $query);
    $row = mysqli_fetch_assoc($result);
    
    // Determine if the checkbox should be checked
    $is_checked = ($row['count'] > 0) ? 'checked' : '';
    
    // Store the checkbox state for this condition
    $checkbox_states[$condition] = $is_checked;

;?>		
               <div class="checkbox checkbox-success checkbox-inline">
<input type="checkbox" id="inlineCheckbox1" name="addiction[]" value="<?php echo $condition?>" <?php echo $is_checked; ?>>
    <label for="inlineCheckbox1"> <?php echo $condition?> </label>
</div>
<?php } ?>
				
				</div>
                  </div>
				  
				   <!------------>
                      <div class="form-group">
                    <label class="col-sm-2 control-label">Water Thirst</label>
                    <div class="col-sm-10">
					
                 <?php
$conditions = array(
"Normal",
    "Absent",
    "At a Time Small quantity at a small interval",
    "At a Time Large quantity Large Interval"
);

// Initialize an array to store checkbox states
$checkbox_states = array();

// Loop through each condition
foreach ($conditions as $condition) {
    // Query to count occurrences of the condition
	
    $query = "SELECT COUNT(*) AS count FROM case_study WHERE water_thirst like '%$condition%' and  case_id='".$_REQUEST['case_id']."'";
    $result = mysqli_query($conn, $query);
    $row = mysqli_fetch_assoc($result);
    
    // Determine if the checkbox should be checked
    $is_checked = ($row['count'] > 0) ? 'checked' : '';
    
    // Store the checkbox state for this condition
    $checkbox_states[$condition] = $is_checked;

;?>		
               <div class="checkbox checkbox-success checkbox-inline">
<input type="checkbox" id="inlineCheckbox1" name="water_thirst[]" value="<?php echo $condition?>" <?php echo $is_checked; ?>>
    <label for="inlineCheckbox1"> <?php echo $condition?> </label>
</div>
<?php } ?>
			
				</div>
                  </div>
				  
				   <!------------>
                      <div class="form-group">
                    <label class="col-sm-2 control-label">Desire / Likes</label>
                    <div class="col-sm-10">
					
               <?php
$conditions = array(
 "Sweet",
    "Spice",
    "Sore",
    "Salty",
    "Fruits",
    "Green Vegetable",
    "Bakery Products",
    "Eggs",
    "Fish",
    "Chicken",
    "Meat");

// Initialize an array to store checkbox states
$checkbox_states = array();

// Loop through each condition
foreach ($conditions as $condition) {
    // Query to count occurrences of the condition
	
    $query = "SELECT COUNT(*) AS count FROM case_study WHERE desire like '%$condition%' and  case_id='".$_REQUEST['case_id']."'";
    $result = mysqli_query($conn, $query);
    $row = mysqli_fetch_assoc($result);
    
    // Determine if the checkbox should be checked
    $is_checked = ($row['count'] > 0) ? 'checked' : '';
    
    // Store the checkbox state for this condition
    $checkbox_states[$condition] = $is_checked;

;?>		
               <div class="checkbox checkbox-success checkbox-inline">
<input type="checkbox" id="inlineCheckbox1" name="desire[]" value="<?php echo $condition?>" <?php echo $is_checked; ?>>
    <label for="inlineCheckbox1"> <?php echo $condition?> </label>
</div>
<?php } ?>
				
				</div>
                  </div>
				  
				   <!------------>
                      <div class="form-group">
                    <label class="col-sm-2 control-label">Aversion / Don’t like</label>
                    <div class="col-sm-10">
					
             <?php
$conditions = array(
 "Sweet",
    "Spice",
    "Sore",
    "Salty",
    "Fruits",
    "Green Vegetable",
    "Bakery Products",
    "Eggs",
    "Fish",
    "Chicken",
    "Meat");

// Initialize an array to store checkbox states
$checkbox_states = array();

// Loop through each condition
foreach ($conditions as $condition) {
    // Query to count occurrences of the condition
	
    $query = "SELECT COUNT(*) AS count FROM case_study WHERE aversion like '%$condition%' and  case_id='".$_REQUEST['case_id']."'";
    $result = mysqli_query($conn, $query);
    $row = mysqli_fetch_assoc($result);
    
    // Determine if the checkbox should be checked
    $is_checked = ($row['count'] > 0) ? 'checked' : '';
    
    // Store the checkbox state for this condition
    $checkbox_states[$condition] = $is_checked;

;?>		
               <div class="checkbox checkbox-success checkbox-inline">
<input type="checkbox" id="inlineCheckbox1" name="aversion[]" value="<?php echo $condition?>" <?php echo $is_checked; ?>>
    <label for="inlineCheckbox1"> <?php echo $condition?> </label>
</div>
<?php } ?>
				
				</div>
                  </div>
				  
				  <!------------>
                      <div class="form-group">
                    <label class="col-sm-2 control-label">Appetite</label>
                    <div class="col-sm-10">
					
              <?php
$conditions = array(
"Normal",
    "Increase",
    "Absent");

// Initialize an array to store checkbox states
$checkbox_states = array();

// Loop through each condition
foreach ($conditions as $condition) {
    // Query to count occurrences of the condition
	
    $query = "SELECT COUNT(*) AS count FROM case_study WHERE appetite like '%$condition%' and  case_id='".$_REQUEST['case_id']."'";
    $result = mysqli_query($conn, $query);
    $row = mysqli_fetch_assoc($result);
    
    // Determine if the checkbox should be checked
    $is_checked = ($row['count'] > 0) ? 'checked' : '';
    
    // Store the checkbox state for this condition
    $checkbox_states[$condition] = $is_checked;

;?>		
               <div class="checkbox checkbox-success checkbox-inline">
<input type="checkbox" id="inlineCheckbox1" name="appetite[]" value="<?php echo $condition?>" <?php echo $is_checked; ?>>
    <label for="inlineCheckbox1"> <?php echo $condition?> </label>
</div>
<?php } ?>
				
				</div>
                  </div>
				  
				   <!------------>
                      <div class="form-group">
                    <label class="col-sm-2 control-label">Stool</label>
                    <div class="col-sm-10">
					
           <?php
$conditions = array(
"Regular",
    "Insufficient",
    "Constipation",
    "Stool with Bleeding");
// Initialize an array to store checkbox states
$checkbox_states = array();

// Loop through each condition
foreach ($conditions as $condition) {
    // Query to count occurrences of the condition
	
    $query = "SELECT COUNT(*) AS count FROM case_study WHERE stool like '%$condition%' and  case_id='".$_REQUEST['case_id']."'";
    $result = mysqli_query($conn, $query);
    $row = mysqli_fetch_assoc($result);
    
    // Determine if the checkbox should be checked
    $is_checked = ($row['count'] > 0) ? 'checked' : '';
    
    // Store the checkbox state for this condition
    $checkbox_states[$condition] = $is_checked;

;?>		
               <div class="checkbox checkbox-success checkbox-inline">
<input type="checkbox" id="inlineCheckbox1" name="stool[]" value="<?php echo $condition?>" <?php echo $is_checked; ?>>
    <label for="inlineCheckbox1"> <?php echo $condition?> </label>
</div>
<?php } ?>
				
				</div>
                  </div>
				  
				    <!------------>
                      <div class="form-group">
                    <label class="col-sm-2 control-label">Urine</label>
                    <div class="col-sm-10">
					
             <?php
$conditions = array(
"Normal",
    "Increase",
    "Absent",
    "Involuntary Urination");
	
	// Initialize an array to store checkbox states
$checkbox_states = array();

// Loop through each condition
foreach ($conditions as $condition) {
    // Query to count occurrences of the condition
	
    $query = "SELECT COUNT(*) AS count FROM case_study WHERE urine like '%$condition%' and  case_id='".$_REQUEST['case_id']."'";
    $result = mysqli_query($conn, $query);
    $row = mysqli_fetch_assoc($result);
    
    // Determine if the checkbox should be checked
    $is_checked = ($row['count'] > 0) ? 'checked' : '';
    
    // Store the checkbox state for this condition
    $checkbox_states[$condition] = $is_checked;

;?>		
               <div class="checkbox checkbox-success checkbox-inline">
<input type="checkbox" id="inlineCheckbox1" name="urine[]" value="<?php echo $condition?>" <?php echo $is_checked; ?>>
    <label for="inlineCheckbox1"> <?php echo $condition?> </label>
</div>
<?php } ?>
				
				</div>
                  </div>
				  
				     <!------------>
                      <div class="form-group">
                    <label class="col-sm-2 control-label">Sleep</label>
                    <div class="col-sm-10">
					
           <?php
$conditions = array(
 "Sound",
    "Increase",
    "Insomnia",
    "Disturbed");
	
	// Initialize an array to store checkbox states
$checkbox_states = array();

// Loop through each condition
foreach ($conditions as $condition) {
    // Query to count occurrences of the condition
	
    $query = "SELECT COUNT(*) AS count FROM case_study WHERE sleep like '%$condition%' and  case_id='".$_REQUEST['case_id']."'";
    $result = mysqli_query($conn, $query);
    $row = mysqli_fetch_assoc($result);
    
    // Determine if the checkbox should be checked
    $is_checked = ($row['count'] > 0) ? 'checked' : '';
    
    // Store the checkbox state for this condition
    $checkbox_states[$condition] = $is_checked;

;?>		
               <div class="checkbox checkbox-success checkbox-inline">
<input type="checkbox" id="inlineCheckbox1" name="sleep[]" value="<?php echo $condition?>" <?php echo $is_checked; ?>>
    <label for="inlineCheckbox1"> <?php echo $condition?> </label>
</div>
<?php } ?>
				</div>
                  </div>
				  
				    <!------------>
				   <div class="form-group">
                    <label class="col-sm-2 control-label">Perspiration</label>
                    <div class="col-sm-10">
					
           <?php
$conditions = array(
"Normal",
    "Increase",
    "Offensive");
	// Initialize an array to store checkbox states
$checkbox_states = array();

// Loop through each condition
foreach ($conditions as $condition) {
    // Query to count occurrences of the condition
	
    $query = "SELECT COUNT(*) AS count FROM case_study WHERE perspiration like '%$condition%' and  case_id='".$_REQUEST['case_id']."'";
    $result = mysqli_query($conn, $query);
    $row = mysqli_fetch_assoc($result);
    
    // Determine if the checkbox should be checked
    $is_checked = ($row['count'] > 0) ? 'checked' : '';
    
    // Store the checkbox state for this condition
    $checkbox_states[$condition] = $is_checked;

;?>		
               <div class="checkbox checkbox-success checkbox-inline">
<input type="checkbox" id="inlineCheckbox1" name="perspiration[]" value="<?php echo $condition?>" <?php echo $is_checked; ?>>
    <label for="inlineCheckbox1"> <?php echo $condition?> </label>
</div>
<?php } ?>
				</div>
                  </div>
				  
				    <!------------>
					
					   <!------------>
				   <div class="form-group">
                    <label class="col-sm-2 control-label">Relation with Heat and Cold</label>
                    <div class="col-sm-10">
					
         <?php
$conditions = array(
"Tolerate Cold",
    "Tolerate Heat",
    "Can Tolerate Both",
    "Cannot Tolerate Both"
);
	// Initialize an array to store checkbox states
$checkbox_states = array();

// Loop through each condition
foreach ($conditions as $condition) {
    // Query to count occurrences of the condition
	
    $query = "SELECT COUNT(*) AS count FROM case_study WHERE Rheatandcold like '%$condition%' and  case_id='".$_REQUEST['case_id']."'";
    $result = mysqli_query($conn, $query);
    $row = mysqli_fetch_assoc($result);
    
    // Determine if the checkbox should be checked
    $is_checked = ($row['count'] > 0) ? 'checked' : '';
    
    // Store the checkbox state for this condition
    $checkbox_states[$condition] = $is_checked;

;?>		
               <div class="checkbox checkbox-success checkbox-inline">
<input type="checkbox" id="inlineCheckbox1" name="Rheatandcold[]" value="<?php echo $condition?>" <?php echo $is_checked; ?>>
    <label for="inlineCheckbox1"> <?php echo $condition?> </label>
</div>
<?php } ?>
				</div>
                  </div>
				  
				   
				<!------------>
				   <div class="form-group">
                    <label class="col-sm-2 control-label">Mind / Manasikta</label>
                    <div class="col-sm-10">
					
         <?php
$conditions = array(
 "Sweet",
    "Spice",
    "Sore",
    "Salty",
    "Fruits"
);
	// Initialize an array to store checkbox states
$checkbox_states = array();

// Loop through each condition
foreach ($conditions as $condition) {
    // Query to count occurrences of the condition
	
    $query = "SELECT COUNT(*) AS count FROM case_study WHERE mind like '%$condition%' and  case_id='".$_REQUEST['case_id']."'";
    $result = mysqli_query($conn, $query);
    $row = mysqli_fetch_assoc($result);
    
    // Determine if the checkbox should be checked
    $is_checked = ($row['count'] > 0) ? 'checked' : '';
    
    // Store the checkbox state for this condition
    $checkbox_states[$condition] = $is_checked;

;?>		
               <div class="checkbox checkbox-success checkbox-inline">
<input type="checkbox" id="inlineCheckbox1" name="mind[]" value="<?php echo $condition?>" <?php echo $is_checked; ?>>
    <label for="inlineCheckbox1"> <?php echo $condition?> </label>
</div>
<?php } ?>
				</div>
                  </div>
				 <!------------>
				 
				 <!------------>
				   <div class="form-group">
                    <label class="col-sm-2 control-label">Memory </label>
                    <div class="col-sm-10">
					
          <?php
$conditions = array(
 "Weak",
    "Medium",
    "Sharp"
);
	// Initialize an array to store checkbox states
$checkbox_states = array();

// Loop through each condition
foreach ($conditions as $condition) {
    // Query to count occurrences of the condition
	
    $query = "SELECT COUNT(*) AS count FROM case_study WHERE memory like '%$condition%' and  case_id='".$_REQUEST['case_id']."'";
    $result = mysqli_query($conn, $query);
    $row = mysqli_fetch_assoc($result);
    
    // Determine if the checkbox should be checked
    $is_checked = ($row['count'] > 0) ? 'checked' : '';
    
    // Store the checkbox state for this condition
    $checkbox_states[$condition] = $is_checked;

;?>		
               <div class="checkbox checkbox-success checkbox-inline">
<input type="checkbox" id="inlineCheckbox1" name="memory[]" value="<?php echo $condition?>" <?php echo $is_checked; ?>>
    <label for="inlineCheckbox1"> <?php echo $condition?> </label>
</div>
<?php } ?>
				</div>
                  </div>
				 <!------------>
				
				
				<div class="form-group">
                    <label class="col-sm-2 control-label">Anxiety about </label>
                    <div class="col-sm-10">
					
         <?php
$conditions = array(
"Health",
    "Money",
    "Future",
    "Family",
    "Children",
    "Job"
);
	// Initialize an array to store checkbox states
$checkbox_states = array();

// Loop through each condition
foreach ($conditions as $condition) {
    // Query to count occurrences of the condition
	
    $query = "SELECT COUNT(*) AS count FROM case_study WHERE anxiety like '%$condition%' and  case_id='".$_REQUEST['case_id']."'";
    $result = mysqli_query($conn, $query);
    $row = mysqli_fetch_assoc($result);
    
    // Determine if the checkbox should be checked
    $is_checked = ($row['count'] > 0) ? 'checked' : '';
    
    // Store the checkbox state for this condition
    $checkbox_states[$condition] = $is_checked;

;?>		
               <div class="checkbox checkbox-success checkbox-inline">
<input type="checkbox" id="inlineCheckbox1" name="anxiety[]" value="<?php echo $condition?>" <?php echo $is_checked; ?>>
    <label for="inlineCheckbox1"> <?php echo $condition?> </label>
</div>
<?php } ?>
				</div>
                  </div>
				 <!------------>
				 
				 <div class="form-group">
                    <label class="col-sm-2 control-label">Likes / Dislikes</label>
                    <div class="col-sm-10">
		 <?php
$conditions = array(
"Music",
    "Company with friends");
	// Initialize an array to store checkbox states
$checkbox_states = array();

// Loop through each condition
foreach ($conditions as $condition) {
    // Query to count occurrences of the condition
	
    $query = "SELECT COUNT(*) AS count FROM case_study WHERE like_dislike like '%$condition%' and  case_id='".$_REQUEST['case_id']."'";
    $result = mysqli_query($conn, $query);
    $row = mysqli_fetch_assoc($result);
    
    // Determine if the checkbox should be checked
    $is_checked = ($row['count'] > 0) ? 'checked' : '';
    
    // Store the checkbox state for this condition
    $checkbox_states[$condition] = $is_checked;

;?>		
               <div class="checkbox checkbox-success checkbox-inline">
<input type="checkbox" id="inlineCheckbox1" name="like_dislike[]" value="<?php echo $condition?>" <?php echo $is_checked; ?>>
    <label for="inlineCheckbox1"> <?php echo $condition?> </label>
</div>
<?php } ?>
				</div>
                  </div>
				 <!------------>
				 
				 <div class="form-group">
                    <label class="col-sm-2 control-label">Your Nature (Evaluate Your Self)</label>
                    <div class="col-sm-10">
	<?php
$conditions = array(
"Ambitious",
    "History of Disappointment",
    "History of Grief",
    "Perfectionist",
    "Time Punctual",
    "Want Clean Everything",
    "Can Not Tolerate Insult",
    "Can Not Tolerate Injustice",
    "Any Specific Mental Symptoms");
	
	
	// Initialize an array to store checkbox states
$checkbox_states = array();

// Loop through each condition
foreach ($conditions as $condition) {
    // Query to count occurrences of the condition
	
    $query = "SELECT COUNT(*) AS count FROM case_study WHERE your_nature like '%$condition%' and  case_id='".$_REQUEST['case_id']."'";
    $result = mysqli_query($conn, $query);
    $row = mysqli_fetch_assoc($result);
    
    // Determine if the checkbox should be checked
    $is_checked = ($row['count'] > 0) ? 'checked' : '';
    
    // Store the checkbox state for this condition
    $checkbox_states[$condition] = $is_checked;

;?>		
               <div class="checkbox checkbox-success checkbox-inline">
<input type="checkbox" id="inlineCheckbox1" name="your_nature[]" value="<?php echo $condition?>" <?php echo $is_checked; ?>>
    <label for="inlineCheckbox1"> <?php echo $condition?> </label>
</div>
<?php } ?>
				</div>
                  </div>
				 <!------------>
				 
				  <div class="form-group">
                    <label class="col-sm-2 control-label">Do you have fear of ?</label>
                    <div class="col-sm-10">
<?php
$conditions = array(
"Darkness",
    "Ghost",
    "Height",
    "Dog",
    "Lizard",
    "Cat",
    "Rat",
    "Insects",
    "Snake",
    "Teacher"
	
	);
	
	
	// Initialize an array to store checkbox states
$checkbox_states = array();

// Loop through each condition
foreach ($conditions as $condition) {
    // Query to count occurrences of the condition
	
    $query = "SELECT COUNT(*) AS count FROM case_study WHERE fear_of like '%$condition%' and  case_id='".$_REQUEST['case_id']."'";
    $result = mysqli_query($conn, $query);
    $row = mysqli_fetch_assoc($result);
    
    // Determine if the checkbox should be checked
    $is_checked = ($row['count'] > 0) ? 'checked' : '';
    
    // Store the checkbox state for this condition
    $checkbox_states[$condition] = $is_checked;

;?>		
               <div class="checkbox checkbox-success checkbox-inline">
<input type="checkbox" id="inlineCheckbox1" name="fear_of[]" value="<?php echo $condition?>" <?php echo $is_checked; ?>>
    <label for="inlineCheckbox1"> <?php echo $condition?> </label>
</div>
<?php } ?>
				</div>
                  </div>
				 <!------------>
				
                </form>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
   	<?php include 'footer1a.php';?>
