<?php
session_start();
include "connect.php";



		$clgamid = intval($_REQUEST['id']);
					$document = array();
	 $eve = " select countrymid,collegemid,campusmid from res_course_master where collegemid in (select collegemid from res_collegeapp_master where clgappmid in (select clgappmid from res_collegeappman_master where clgamid =$clgamid ))";
	
	$re = mysqli_query($conn, $eve);
	 while($rt = mysqli_fetch_assoc($re))
										
	{
		 $countrymid1 = $rt['countrymid'];
		$collegemid1 = $rt['collegemid'];
		$campusmid1 = $rt['campusmid'];
		
	}
		
		

?>

<input type="hidden" name="clgamid" value="<?php echo $clgamid; ?>">
											<!--begin::Row-->
												<div class="row row-cols-1 row-cols-sm-2 rol-cols-md-1 row-cols-lg-2">
													
													<!--begin::Col-->
													<div class="col-md-6 fv-row">
																<!--begin::Input group-->
																<div class="fv-row mb-7">
																	<!--begin::Label-->
																	<label class=" fw-semibold fs-6 mb-2"> Country</label>
																	<!--end::Label-->
																	<!--begin::Input-->
																	<select class="form-select form-select-solid" data-control="select2" data-dropdown-parent="#kt_modal_add_user_form31"  name="countrymid" id="countrymid2" disabled>
																	<option value="0">Select</option>
													<?php 
																			$eve_main = "select * from res_country_master where countrymid in (select countrymid from res_college_master)";
										$re_main = mysqli_query($conn, $eve_main);
										while($rt_main = mysqli_fetch_assoc($re_main))
										{

											$countrymid=$rt_main['countrymid'];
											$countryname=$rt_main['countryname'];
											if($countrymid1==$countrymid)
											{
												echo "<option value='$countrymid' selected>$countryname</option>";
											}
											else
											{
												echo "<option value='$countrymid'>$countryname</option>";
											}

										}
																			
																	?>
													</select>
																	<!--end::Input-->
																</div>
																<!--end::Input group-->
																</div>
													<!--end::Col-->
													
													
													<!--begin::Col-->
													<div class="col-md-6 fv-row">
																<!--begin::Input group-->
																<div class="fv-row mb-7">
																	<!--begin::Label-->
																	<label class="required fw-semibold fs-6 mb-2">College </label>
																	<!--end::Label-->
																	<!--begin::Input-->
																	<select class="form-select form-select-solid" data-control="select2" data-dropdown-parent="#kt_modal_add_user_form31" name="collegemid" id="collegemid2" disabled>
										<option value="0">Select College</option>
										<?php 
																			$eve_main = "select * from res_college_master where countrymid=$countrymid1 ";
										$re_main = mysqli_query($conn, $eve_main);
										while($rt_main = mysqli_fetch_assoc($re_main))
										{

											$collegemid=$rt_main['collegemid'];
											$cmname=$rt_main['cmname'];
											if($collegemid1==$collegemid)
											{
												echo "<option value='$collegemid' selected>$cmname</option>";
											}
											else
											{
												echo "<option value='$collegemid'>$cmname</option>";
											}

										}
																			
																	?>
									</select>
																	<!--end::Input-->
																</div>
																<!--end::Input group-->
																</div>
													<!--end::Col-->
													<!--begin::Col-->
													<div class="col-md-6 fv-row">
																<!--begin::Input group-->
																<div class="fv-row mb-7">
																	<!--begin::Label-->
																	<label class="required fw-semibold fs-6 mb-2">College Campus</label>
																	<!--end::Label-->
																	<!--begin::Input-->
																	<select class="form-select form-select-solid" data-control="select2" data-dropdown-parent="#kt_modal_add_user_form41" name="ccampusmid" id="ccampusmid" required>
										<option value="0">Select Campus</option>
										<?php 
																			$eve_main = "select * from res_collegecampus_master where collegemid=$collegemid1 ";
										$re_main = mysqli_query($conn, $eve_main);
										while($rt_main = mysqli_fetch_assoc($re_main))
										{

											$ccampusmid=$rt_main['ccampusmid'];
											$campusname=$rt_main['campusname'];
											if($campusmid1==$ccampusmid)
											{
												echo "<option value='$ccampusmid' selected>$campusname</option>";
											}
											else
											{
												echo "<option value='$ccampusmid'>$campusname</option>";
											}

										}
																			
																	?>
									</select>
																	<!--end::Input-->
																</div>
																<!--end::Input group-->
																</div>
													
													<!--begin::Col-->
													<div class="col-md-6 fv-row">
																<!--begin::Input group-->
																<div class="fv-row mb-7">
																	<!--begin::Label-->
																	<label class="required fw-semibold fs-6 mb-2">Course </label>
																	<!--end::Label-->
																	<!--begin::Input-->
																	<select class="form-select form-select-solid" data-control="select2" data-dropdown-parent="#kt_modal_add_user_form41" name="coursemid" id="coursemid22">
										<option value="0">Select Course</option>
									</select>
										
									
																	<!--end::Input-->
																</div>
																<!--end::Input group-->
																</div>
																</div>
													<!--end::Col-->
																						<!--begin::Row-->
												<div class="row row-cols-1 row-cols-sm-2 rol-cols-md-1 row-cols-lg-2">
													<!--begin::Col-->
													<div class="col-md-6 fv-row">
																<!--begin::Input group-->
																<div class="fv-row mb-7">
																	<!--begin::Label-->
																	<label class=" fw-semibold fs-6 mb-2">Remarks </label>
																	<!--end::Label-->
																	<!--begin::Input-->
																	
																	<input type="text" name="coremarks" id="coremarks"  class="form-control form-control-solid fw-bold pe-5" aria-required="true" aria-invalid="false" aria-describedby="name-error" />
																	<!--end::Input-->
																</div>
																<!--end::Input group-->
																</div>
													<!--end::Col-->
													
													<!--begin::Col-->
													<div class="col-md-6 fv-row">
																<!--begin::Input group-->
																<div class="fv-row mb-7">
																	<!--begin::Label-->
																	<label class="required fw-semibold fs-6 mb-2">Application Fees </label>
																	<!--end::Label-->
																	<!--begin::Input-->
																	<input type="text" name="coursefees" id="cgrosstutionfess234"  class="form-control form-control-solid fw-bold pe-5"  required>
																	<!--end::Input-->
																</div>
																<!--end::Input group-->
																</div>
													<!--end::Col-->
													</div>
												<!--end::Row-->
																		<!--begin::Row-->
												<div class="row row-cols-1 row-cols-sm-2 rol-cols-md-1 row-cols-lg-2">
													<!--begin::Col-->
													<div class="col-md-6 fv-row">
																<!--begin::Input group-->
																<div class="fv-row mb-7">
																	<!--begin::Label-->
																	<label class="required fw-semibold fs-6 mb-2">Status </label>
																	<!--end::Label-->
																	<!--begin::Input-->
																	<select class="form-select form-select-solid" data-control="select2"   name="capstatus" id="status12">
																	<option value="0">Select</option>
																	<option value="New">New</option>
																	<option value="Application Recevied">Application Recevied</option>
													
													</select>
																	<!--end::Input-->
																</div>
																<!--end::Input group-->
																</div>
													<!--end::Col-->
													
													<!--begin::Col-->
													<div class="col-md-6 fv-row">
																<!--begin::Input group-->
																<div class="fv-row mb-7">
																	<!--begin::Label-->
																	<label class="required fw-semibold fs-6 mb-2">Inquiry Date </label>
																	<!--end::Label-->
																	<!--begin::Input-->
																	<input class="form-control form-control-solid fw-bold pe-5" placeholder="Select date" name="doapplication" id="kt_daterangepicker_28"/>
																	<!--end::Input-->
																</div>
																<!--end::Input group-->
																</div>
													<!--end::Col-->
													</div>
												<!--end::Row-->
																<div class="row row-cols-1 row-cols-sm-2 rol-cols-md-1 row-cols-lg-2">
											<!--begin::Col-->
													<div class="col">
														<!--begin::Input group-->
														<div class="fv-row mb-7">
															<!--begin::Label-->
															<label class="fs-6 fw-semibold form-label mt-3">
																<span class="required">Intake Month </span>
																
															</label>
															<!--end::Label-->
															<!--begin::Input-->
															
															<select class="form-select form-select-solid fw-bold" data-control="select2" data-dropdown-parent="#kt_modal_add_user_form41" name="cintakemonth" id="citdid3">
														<option value="0">Select2<option>
														
														</select>
												
															<!--end::Input-->
														</div>
														<!--end::Input group-->
													</div>
													<!--end::Col-->
													<!--begin::Col-->
													<div class="col">
														<!--begin::Input group-->
														<div class="fv-row mb-7">
															<!--begin::Label-->
															<label class="fs-6 fw-semibold form-label mt-3">
																<span class="required">Intake Year </span>
																
															</label>
															<!--end::Label-->
															<!--begin::Input-->
															
															<select class="form-select form-select-solid fw-bold" data-control="select2"   name="cintakeyear">
														<?php
														for($i= 2022;$i<2040; $i++)
														{
															echo "<option value='$i' >$i </option>";
														}
														?>
														</select>
												
															<!--end::Input-->
														</div>
														<!--end::Input group-->
													</div>
													<!--end::Col-->
													
													
												</div>
												<!--end::Row-->
												<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>

										<script type="text/javascript">
		$(document).ready(function(){
			$("#kt_daterangepicker_28").flatpickr({
        enableTime:!1,dateFormat:"d-m-Y"
    });
		});
		</script>
															<script type="text/javascript">
			$(document).ready(function(){
				$('#coursemid22').on('change',function(){
					var coursemid = $(this).val();
					
					if(coursemid){
						
						$.ajax({
							type:'POST',
							url:'courseintake.php',
							data:'coursemid='+coursemid,
							success:function(html){
								$('#citdid3').html(html);
							}
						});
					}else{
						$('#citdid3').html('<option value="">333</option>');
					}
				});
			});
	</script><script type="text/javascript">
			$(document).ready(function(){
				
					var coursemid = $('#coursemid22').val();
					
					if(coursemid){
						
						$.ajax({
							type:'POST',
							url:'courseintake.php',
							data:'coursemid='+coursemid,
							success:function(html){
								$('#citdid3').html(html);
							}
						});
					}else{
						$('#citdid3').html('<option value="">333</option>');
					}
				});
			
	</script>
	<script type="text/javascript">
			$(document).ready(function(){
				$('#ccampusmid').on('change',function(){
					var ccampusmid = $(this).val();
					//alert(ccampusmid);
					if(ccampusmid){
						$.ajax({
							type:'POST',
							url:'coursecampusdata.php',
							data:'ccampusmid='+ccampusmid,
							success:function(html){
								$('#coursemid22').html(html);
							}
						});
					}else{
						$('#coursemid22').html('<option value=""></option>');
					}
				});
			});
	</script>
	<script type="text/javascript">
			$(document).ready(function(){
				
					var ccampusmid = $('#ccampusmid').val();
					if(ccampusmid){
						$.ajax({
							type:'POST',
							url:'coursecampusdata.php',
							data:'ccampusmid='+ccampusmid,
							success:function(html){
								$('#coursemid22').html(html);
							}
						});
					}else{
						$('#coursemid22').html('<option value=""></option>');
					}
				});
			
	</script>

<script>
$('#coursemid22').on('change',function()
{
	
	
	
	$.get("coursefees.php", { coursemid : $(this).val() }, function(response) 
	{
		$('#cgrosstutionfess234').val( $.trim(response) );

	});
});
</script>	
