<?php
$tid=$this->uri->segment('3');
$teacher_profile_data =$this->SchoolModel->teacher_profile($tid);

if($teacher_profile_data){
    foreach($teacher_profile_data as $records){ 
?>

<div class="container mt-3 mb-3 pt-3 pb-3 bg-white">
    <div class="row">
        <div class="col-sm-12">
            <ul class="breadcrumb">
                <li class="breadcrumb-item"><a href="<?php echo base_url();?>Welcome">Home</a></li>
                <li class="breadcrumb-item"><a href="<?php echo base_url();?>school/profile">Profile</a></li>
                <li class="breadcrumb-item">Update Personal Information</li>
            </ul>
            
            <form method="post" action="#">
                <?php
                if($success){
                ?>
                <div class="alert alert-success"><?php echo $success;?></div>
                <?php
                }
                
                if($error){
                ?>
                <div class="alert alert-danger"><?php echo $error;?></div> 
                <?php
                }
                ?>
                <input type="hidden" value="<?php echo $records['id'];?>" name="tid">
                <div class="form-group">
                    <label>Salutation : <span><?php echo form_error('salutation');?></span></label>    
                    <select class="form-control" name="salutation">
                        <option value="">Select</option>    
                        <option value="Mr." <?php if($records['salutation'] == "Mr."){echo "selected";} ?>>Mr.</option>    
                        <option value="Mrs." <?php if($records['salutation'] == "Mrs."){echo "selected";} ?>>Mrs.</option>
                        <option value="Ms." <?php if($records['salutation'] == "Ms."){echo "selected";} ?>>Ms.</option>
                        <option value="Dr." <?php if($records['salutation'] == "Dr."){echo "selected";} ?>>Dr.</option>
                    </select>
                </div> 

                <div class="form-group">
                    <label>Name : <span><?php echo form_error('name');?></span></label>
                    <input type="text" name="teacher_name" value="<?php echo $records['name'];?>" class="form-control" placeholder="Your Name">
                </div>

                <div class="form-group">
                    <label>Father Name : <span><?php echo form_error('father_name');?></span></label>
                    <input type="text" name="father_name" value="<?php echo $records['father_name'];?>" class="form-control" placeholder="Father's Name">
                </div>

                <div class="form-group">
                    <label>D.O.B. : <span><?php echo form_error('dob');?></span></label>
                    <input type="date" name="dob" value="<?php echo $records['dob'];?>" class="form-control">
                </div>
    
                <div class="form-group">
                    <label>Marital Status : <span><?php echo form_error('marital_status');?></span></label>
                    <select class="form-control"  name="marital_status">
                        <option value="Unmarried" <?php if($records['marital_status']=='Unmarried'){echo "selected";}?>>Unmarried</option>
                        <option value="Married" <?php if($records['marital_status']=='Married'){echo "selected";}?>>Married</option>
                    </select>
                </div>


                <div class="form-group">
                    <label>Gender :  <span><?php echo form_error('gender');?></span></label>
                    <input type="radio" id="gender" name="gender" value="Male" <?php if($records['gender']=='Male'){echo "checked";}?>>
                    <label for="Male">Male</label>
                    <input type="radio" id="gender" name="gender" value="Female" <?php if($records['gender']=='Female'){echo "checked";}?>>
                    <label for="Female">Female</label>
                </div>

                <div class="form-group">
                    <label>Aadhar Number : <span><?php echo form_error('aadhar_no');?></span></label>    
                    <input type="number" name="aadhar_no" id="aadhar_no" value="<?php echo $records['aadhar_no']; ?>" class="form-control">
                </div>                
                
                <div class="form-group">
                    <button type="submit" name="update_personal_information" class="btn btn-sm btn-success">Update Personal Information</button>
                </div>
                
            </form>
        </div>
    </div>
</div>

<?php
    }
}
?>