JezK
Edit File: add_student.php
<?php session_start(); include("header.php"); include_once("student_access.php"); $student=new student_access(); ///////////////////////////////////// $timeout=$student->check_my_status($_SESSION['child']['log_school_id']); if($timeout==0) echo "<script>location.replace('logout.php');</script>"; ///////////////////////////////////// $sch_id = $_SESSION['child']['log_school_id']; $acadamic_id = $_SESSION['child']['current_academic_id']; //~ echo $acadamic_id; $sessionid = $_SESSION['stude_section_id']; $classid = $_SESSION['stude_class_id']; $choosen_acc_id = $_SESSION['child']['choosen_academic_id']; $details=$student->get_classes_byschool_total($sch_id,$choosen_acc_id); //~ print_r($details) if($acadamic_id != $choosen_acc_id){ $a_id = $choosen_acc_id; }else{ $a_id = $acadamic_id; } //~ print_r($_POST['classes']); if($_POST['classes']) { //~ echo "hello"; $details_sections =$student->get_sections_bystudent($_POST['classes']); } $school_licene_count =$student->check_license_count($sch_id); $licencecount = ''; foreach($school_licene_count as $key=>$val) { $licencecount = $licencecount + $key; } //$students_count = $student->check_student_count($sch_id); //$students_count = $student->check_student_count_add($sch_id,$acadamic_id,$choosen_acc_id); $students_count = $student->check_student_count_add_data($sch_id,$a_id); if($_POST['action'] == "add") { //print_r($_FILES); //exit; //if($students_count['cnt'] < $licencecount) //{ $check_student = $student->check_student($_POST['stu_admissionnumber'],$sch_id,$choosen_acc_id); $check_student_roll = $student->check_student_roll($_POST['stu_rollnum'],$_POST['classes'],$_POST['sections'],$sch_id,$choosen_acc_id); if(!$check_student) { if(!$check_student_roll) { if($_FILES["profile_pic"]["name"]) { $t = $_FILES["profile_pic"]["tmp_name"]; $n = $_FILES["profile_pic"]["name"]; $p=strtotime(date('d-m-Y H:i:s')); $k=substr(str_shuffle($p),0,5); $tfname=$k.$n; if(move_uploaded_file($t, "uploads/studentspics/".$tfname)) { $im_url=$tfname; }else { $im_url='default.png'; } } //echo $im_url; //exit; $result=$student->create_student($_POST,$im_url,$_SESSION); if($result!=ERR204) { echo "<script>location.replace('student_management.php?cresult=ERR203');</script>" ; } else { echo "<script>alert('Please check the Student details');</script>" ; } } else { echo "<script>alert('The Roll Number for this class and section already exists');</script>" ; } } else { echo "<script>alert('Admission Number already exists');</script>" ; } /*} else { echo "<script>alert('You already consumed all student licenses. Please purchase additional licenses in order to add more students into the system');</script>" ; }*/ } ?> <script> $(document).ready(function() { $('#err_class').hide(); $('#err_fathername').hide(); $('#err_section').hide(); $('#err_fatheremail').hide(); $('#err_admissionumber').hide(); $('#err_fathermobile').hide(); $('#err_admissiondate').hide(); $('#err_mothername').hide(); $('#err_studentrollnum').hide(); $('#err_motheremail').hide(); $('#err_stufirstname').hide(); $('#err_mothermobile').hide(); $('#err_stulastname').hide(); $('#err_stugurdianname').hide(); $('#err_stuaddress').hide(); $('#err_gurdianemail').hide(); $('#err_blodgroup').hide(); $('#err_gurdianmobile').hide(); }); function inputvalidations() { $('#err_class').text(''); $('#err_fathername').text(''); $('#err_section').text(''); $('#err_fatheremail').text(''); $('#err_admissionumber').text(''); $('#err_fathermobile').text(''); $('#err_admissiondate').text(''); $('#err_admissiondate2').text(''); $('#err_mothername').text(''); $('#err_studentrollnum').text(''); $('#err_motheremail').text(''); $('#err_stufirstname').text(''); $('#err_mothermobile').text(''); $('#err_stulastname').text(''); $('#err_stugurdianname').text(''); $('#err_stuaddress').text(''); $('#err_gurdianemail').text(''); $('#err_blodgroup').text(''); $('#err_gurdianmobile').text(''); $('#err_fathermobile2').text(''); $('#err_mothermobile2').text(''); $('#err_guardianmobile2').text(''); var parents = []; var stu_class = document.getElementById('classes').value; var details_father = document.getElementById('details_father').value; var details_mother = document.getElementById('details_mother').value; var details_gaurdian = document.getElementById('details_gaurdian').value; if(stu_class != '') { var stu_section = document.getElementById('sections').value; document.getElementById('classes').focus(); } var stu_fathername = (document.getElementById('stu_fathername').value).trim(); var stu_fatheremail = document.getElementById('stu_fatheremail').value; var stu_fathermobile = document.getElementById('stu_fathermobile').value; var stu_fathermobile2 = document.getElementById('stu_fathermobile2').value; var stu_mothername = (document.getElementById('stu_mothername').value).trim(); var stu_motheremail = document.getElementById('stu_motheremail').value; var stu_mothermobile= document.getElementById('stu_mothermobile').value; var stu_mothermobile2 = document.getElementById('stu_mothermobile2').value; var stu_gurdianname = (document.getElementById('stu_gurdianname').value).trim(); var stu_gurdianemail = document.getElementById('stu_gurdianemail').value; var stu_gurdianmobile = document.getElementById('stu_gurdianmobile').value; var stu_gurdianmobile2 = document.getElementById('stu_gurdianmobile2').value; var stu_admissionnumber = (document.getElementById('stu_admissionnumber').value).trim(); var stu_admidate = document.getElementById('stu_admissiondate').value; var stu_birthdate = document.getElementById('stu_birthdate').value; var stu_rollnum = (document.getElementById('stu_rollnum').value).trim(); var stu_firstname = (document.getElementById('stu_firstname').value).trim(); var stu_lastname = (document.getElementById('stu_lastname').value).trim(); var stu_address = (document.getElementById('stu_address').value).trim(); var stu_blodgroup = document.getElementById('stu_blodgroup').value; var regex_email =/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/; var regex_mobile =/^[0-9]*$/; var regex = /^[a-zA-Z0-9 ]*$/; var regex1=/^[\w\d\s.\-\/\(\)]+$/; var regex_address =/^[A-Za-z0-9\n_@.,#;:\/\- ]*$/; if(stu_class == '0') { $('#err_class').show(); $('#err_class').text('Please select Class'); document.getElementById('classes').focus(); return false; } else if(stu_section == '0') { $('#err_section').text('Please select Section'); $('#err_section').show(); document.getElementById('sections').focus(); return false; } else if(stu_admissionnumber == '') { $('#err_admissionumber').text('Please enter Admission Number'); $('#err_admissionumber').show(); document.getElementById('stu_admissionnumber').focus(); return false; } else if(!regex1.test(stu_admissionnumber)) { $('#err_admissionumber').text('Please enter a valid Admission Number'); $('#err_admissionumber').show(); document.getElementById('stu_admissionnumber').focus(); return false; } else if(stu_admidate == '') { $('#err_admissiondate').text('Please enter Admission Date'); $('#err_admissiondate').show(); document.getElementById('stu_admissiondate').focus(); return false; } else if(stu_birthdate == '') { $('#err_admissiondate2').text('Please enter Date of Birth'); $('#err_admissiondate2').show(); document.getElementById('stu_birthdate').focus(); return false; } else if(stu_rollnum == '') { $('#err_studentrollnum').text('Please enter Student Roll Number'); $('#err_studentrollnum').show(); document.getElementById('stu_rollnum').focus(); return false; } else if(!regex.test(stu_rollnum)) { $('#err_studentrollnum').text('Please enter a valid Student Roll Number'); $('#err_studentrollnum').show(); document.getElementById('stu_rollnum').focus(); return false; } else if(stu_firstname == '') { $('#err_stufirstname').text('Please enter Student First Name'); $('#err_stufirstname').show(); document.getElementById('stu_firstname').focus(); return false; } else if(!regex.test(stu_firstname)) { $('#err_stufirstname').text('Please enter a valid Student First Name'); $('#err_stufirstname').show(); document.getElementById('stu_firstname').focus(); return false; } else if(stu_lastname == '') { $('#err_stulastname').text('Please enter Student Last Name'); $('#err_stulastname').show(); document.getElementById('stu_lastname').focus(); return false; } else if(!regex.test(stu_lastname)) { $('#err_stulastname').text('Please enter a valid Student Last Name'); $('#err_stulastname').show(); document.getElementById('stu_lastname').focus(); return false; } else if(stu_address == '') { $('#err_stuaddress').text('Please enter Student Address'); $('#err_stuaddress').show(); document.getElementById('stu_address').focus(); return false; } else if(!regex_address.test(stu_address)) { $('#err_stuaddress').text('Please enter a valid Student Address'); $('#err_stuaddress').show(); document.getElementById('stu_address').focus(); return false; } else if(stu_fathername == '') { $('#err_fathername').text('Please enter Father Name'); $('#err_fathername').show(); document.getElementById('stu_fathername').focus(); return false; } else if(!regex.test(stu_fathername)) { $('#err_fathername').text('Please enter a valid Father Name'); $('#err_fathername').show(); document.getElementById('stu_fathername').focus(); return false; } else if(stu_fatheremail == '') { $('#err_fatheremail').text('Please enter Father Email Address'); $('#err_fatheremail').show(); document.getElementById('stu_fatheremail').focus(); return false; } else if(!regex_email.test(stu_fatheremail)) { $('#err_fatheremail').text('Please enter a valid Father Email Address'); $('#err_fatheremail').show(); document.getElementById('stu_fatheremail').focus(); return false; } else if(stu_fathermobile=='') { $('#err_fathermobile').text('Please enter Father Mobile Number'); $('#err_fathermobile').show(); document.getElementById('stu_fathermobile').focus(); return false; } else if(!regex_mobile.test(stu_fathermobile)) { $('#err_fathermobile').text('Please enter a valid Father Mobile Number'); $('#err_fathermobile').show(); document.getElementById('stu_fathermobile').focus(); return false; } else if(stu_fathermobile.length!=10) { $('#err_fathermobile').text('Please enter a valid Father Mobile Number'); $('#err_fathermobile').show(); document.getElementById('stu_fathermobile').focus(); return false; } else if(stu_mothername == '') { $('#err_mothername').text('Please enter Mother Name'); $('#err_mothername').show(); document.getElementById('stu_mothername').focus(); return false; } else if(!regex.test(stu_mothername)) { $('#err_mothername').text('Please enter a valid Mother Name'); $('#err_mothername').show(); document.getElementById('stu_mothername').focus(); return false; } else if(stu_motheremail == '') { $('#err_motheremail').text('Please enter Mother Email Address'); $('#err_motheremail').show(); document.getElementById('stu_motheremail').focus(); return false; } else if(!regex_email.test(stu_motheremail)) { $('#err_motheremail').text('Please enter a valid Mother Email Address'); $('#err_motheremail').show(); document.getElementById('stu_motheremail').focus(); return false; } else if(stu_mothermobile == '') { $('#err_mothermobile').text('Please enter Mother Mobile Number'); $('#err_mothermobile').show(); document.getElementById('stu_mothermobile').focus(); return false; } else if(!regex_mobile.test(stu_mothermobile)) { $('#err_mothermobile').text('Please enter a valid Mother Mobile Number'); $('#err_mothermobile').show(); document.getElementById('stu_mothermobile').focus(); return false; } else if(stu_mothermobile.length!=10) { $('#err_mothermobile').text('Please enter a valid Mother Mobile Number'); $('#err_mothermobile').show(); document.getElementById('stu_mothermobile').focus(); return false; } if(stu_fathermobile2 != '') { if(!regex_mobile.test(stu_fathermobile2)) { $('#err_fathermobile2').text('Please enter a valid Father Mobile Number2'); $('#err_fathermobile2').show(); document.getElementById('stu_fathermobile2').focus(); return false; } else if(stu_fathermobile2.length!=10) { $('#err_fathermobile2').text('Please enter a valid Father Mobile Number2'); $('#err_fathermobile2').show(); document.getElementById('stu_fathermobile2').focus(); return false; } } if(stu_mothermobile2 != '') { if(!regex_mobile.test(stu_mothermobile2)) { $('#err_mothermobile2').text('Please enter a valid Mother Mobile Number2'); $('#err_mothermobile2').show(); document.getElementById('stu_mothermobile2').focus(); return false; } else if(stu_mothermobile2.length!=10) { $('#err_mothermobile2').text('Please enter a valid Mother Mobile Number2'); $('#err_mothermobile2').show(); document.getElementById('stu_mothermobile2').focus(); return false; } } if(stu_gurdianname!='') { if(!regex.test(stu_gurdianname)) { $('#err_stugurdianname').text('Please enter Guardian Name'); $('#err_stugurdianname').show(); document.getElementById('stu_gurdianname').focus(); return false; } } if(stu_gurdianemail != '') { if(!regex_email.test(stu_gurdianemail)) { $('#err_gurdianemail').text('Please enter a valid Guardian Email Address'); $('#err_gurdianemail').show(); document.getElementById('stu_gurdianemail').focus(); return false; } } if(stu_gurdianmobile != '') { if(!regex_mobile.test(stu_gurdianmobile)) { $('#err_gurdianmobile').text('Please enter a valid Guardian Mobile Number'); $('#err_gurdianmobile').show(); document.getElementById('stu_gurdianmobile').focus(); return false; } else if(stu_gurdianmobile.length!=10) { $('#err_gurdianmobile').text('Please enter a valid Guardian Mobile Number'); $('#err_gurdianmobile').show(); document.getElementById('stu_gurdianmobile').focus(); return false; } } if(stu_gurdianmobile2 != '') { if(!regex_mobile.test(stu_gurdianmobile2)) { $('#err_guardianmobile2').text('Please enter a valid Guardian Mobile Number2'); $('#err_guardianmobile2').show(); document.getElementById('stu_gurdianmobile2').focus(); return false; } else if(stu_gurdianmobile2.length!=10) { $('#err_guardianmobile2').text('Please enter a valid Guardian Mobile Number2'); $('#err_guardianmobile2').show(); document.getElementById('stu_gurdianmobile2').focus(); return false; } } } function student_father_mobile2(val) { //alert(val); var regex_mobile =/^[0-9]*$/; if(!regex_mobile.test(val)) { //alert(val); $('#err_fathermobile2').show(); document.getElementById('stu_fathermobile2').focus(); return false; } else if(val.length!=10) { $('#err_fathermobile2').text('Please enter a valid Father Mobile Number2'); $('#err_fathermobile2').show(); document.getElementById('stu_fathermobile2').focus(); return false; } else { return true; } } function clearall() { document.getElementById('classes').value = ''; document.getElementById('stu_fathername').value = ''; document.getElementById('sections').value = ''; document.getElementById('stu_fatheremail').value = ''; document.getElementById('stu_admissionnumber').value = ''; document.getElementById('stu_fathermobile').value = ''; document.getElementById('stu_fathermobile2').value = ''; document.getElementById('stu_admissiondate').value = ''; document.getElementById('stu_mothername').value = ''; document.getElementById('stu_rollnum').value = ''; document.getElementById('stu_motheremail').value = ''; document.getElementById('stu_firstname').value = ''; document.getElementById('stu_mothermobile').value = ''; document.getElementById('stu_mothermobile2').value = ''; document.getElementById('stu_lastname').value = ''; document.getElementById('stu_gurdianname').value = ''; document.getElementById('stu_address').value = ''; document.getElementById('stu_gurdianemail').value = ''; document.getElementById('stu_blodgroup').value = ''; document.getElementById('stu_gurdianmobile').value = ''; document.getElementById('stu_gurdianmobile2').value = ''; window.location="student_management.php"; } function check_val(val) { var father = document.getElementById('stu_fathername').value; var mother = document.getElementById('stu_mothername').value; var gurdian = document.getElementById('stu_gurdianname').value; var details_father = document.getElementById('details_father').value; var details_mother = document.getElementById('details_mother').value; var details_gaurdian = document.getElementById('details_gaurdian').value; if(father != '') { document.getElementById('details_father').value = '1'; } if(mother != '') { document.getElementById('details_mother').value = '2'; } if(gurdian != '') { document.getElementById('details_gaurdian').value = '3'; } } </script> <body style="overflow-x: hidden;"> <div class="row" style="margin-top:30px;"> <div class="col-md-3 text-center" style="font:Arial, Helvetica, sans-serif;font-style:normal;font-size:14px; color:#000000; font-size:1.4em;margin-left:-35px;"> <i class=" glyphicon glyphicon-plus" title ="Add Student" style="font-size: 16px;"></i> Add Student </div> </div> <div class="row"> <!-- Left col --> <div class="col-md-12" > <!-- MAP & BOX PANE --> <form class="form-horizontal" method="post" enctype="multipart/form-data"> <div class="box-body" style="background-color:#fff; padding: 10px; font-family:Arial, Helvetica, sans-serif; font-size:13px; margin-top:25px;"> <div class="form-group col-md-6" style="margin-bottom:1.0%;"> <div class="col-md-4 col-md-offset-1 text-right"> <b style="color:#666666;">Choose Class</b><span style="color:#FF0000;">*</span> </div> <div class="col-md-7" style="padding-left: 24px;"> <select class="form-control" id="classes" name="classes" style="height:29px; font-size:12px;" tabindex="1" > <option selected="selected" value='0'>--Select Class--</option> <?php foreach($details as $key=>$row) { if($row['class_id'] == $_POST['classes']) { $select = "selected=selected"; } else { $select = ''; } echo "<option value='{$row['class_id']}'{$select}>{$row['class_name']}</option>"; }?> </select> <!-- if there is an error--> <div class="col-md-10" id="err_class" style="color:#990000;margin-left:-15px; display:none;"></div> <!--- end error--> </div> </div> <div class="form-group col-md-6" style="margin-bottom:1.0%;"> <div class="col-md-5 text-right "> <b style="color:#666666;">Father Name</b><span style="color:#FF0000;">*</span> </div> <div class="col-md-7" style="padding-left:7px;"> <input type="text" class="form-control" id="stu_fathername" name="stu_fathername" maxlength="50" onblur="check_val(this.value)" style="height:29px;font-size:13px;width:273px;" tabindex="11" value="<?php echo $_POST['stu_fathername']?>"> <!-- if there is an error--> <div class="col-md-10" id="err_fathername" style="color:#990000;margin-left:-15px; display:none;"></div> <!--- end error--> </div> </div> <div class="form-group col-md-6" style="margin-bottom:1.0%; clear:both;"> <div class="col-md-4 col-md-offset-1 text-right"> <b style="color:#666666;">Choose Section</b><span style="color:#FF0000;">*</span> </div> <div class="col-md-7" style="padding-left: 24px;"> <select class="form-control" id="sections" name="sections" style="height:29px; font-size:12px;" tabindex="2" > <option selected="selected" value='0' >--Select Section--</option> <?php if(count($details_sections)>0) foreach($details_sections as $key=>$row) { if($row['section_id'] == $_POST['sections']) { $select = "selected=selected"; } else { $select = ''; } echo "<option value='{$row['section_id']}'{$select}>{$row['section_name']}</option>"; }?> </select> <!-- if there is an error--> <div class="col-md-10" id="err_section" style="color:#990000;margin-left:-15px; display:none;"></div> <!--- end error--> </div> </div> <div class="form-group col-md-6" style="margin-bottom:1.0%;"> <div class="col-md-5 text-right "> <b style="color:#666666;">Father Email</b><span style="color:#FF0000;">*</span> </div> <div class="col-md-7" style="padding-left:7px;"> <input type="text" class="form-control" id="stu_fatheremail" maxlength="50" name="stu_fatheremail" style="height:29px;font-size:13px;width:273px;" tabindex="12" value="<?php echo $_POST['stu_fatheremail']?>"> <!-- if there is an error--> <div class="col-md-10" id="err_fatheremail" style="color:#990000;margin-left:-15px; display:none;"></div> <!--- end error--> </div> </div> <div class="form-group col-md-6" style="margin-bottom:1.0%; clear:both;"> <div class="col-md-4 col-md-offset-1 text-right"> <b style="color:#666666;">Admission Number </b> <span style="color:#FF0000;margin-left:-4px;">*</span> </div> <div class="col-md-7" style="padding-left: 24px;"> <input type="text" class="form-control" id="stu_admissionnumber" name="stu_admissionnumber" maxlength="50" style="height:29px;font-size:13px;" tabindex="3" value="<?php echo $_POST['stu_admissionnumber']?>"> <!-- if there is an error--> <div class="col-md-10" id="err_admissionumber" style="color:#990000;margin-left:-15px; display:none;"></div> <!--- end error--> </div> </div> <div class="form-group col-md-6" > <div class="col-md-5 text-right "> <b style="color:#666666;">Father Mobile</b><span style="color:#FF0000;">*</span> </div> <div class="col-md-7" style="padding-left:7px;"> <input type="text" class="form-control" id="stu_fathermobile" maxlength="10" name="stu_fathermobile" style="height:29px;font-size:13px;width:273px;" tabindex="13" value="<?php echo $_POST['stu_fathermobile']?>"> <!-- if there is an error--> <div class="col-md-11" id="err_fathermobile" style="color:#990000;margin-left:-15px; display:none;"></div> <!--- end error--> </div> </div> <div class="col-md-12"> <div class="class" > <div class="form-group col-md-6" style="clear:both;"> <div class="col-md-4 col-md-offset-1 text-right"> <b style="color:#666666;">Admission Date</b><span style="color:#FF0000;">*</span> </div> <div class="col-md-7 "> <div id="datetimepicker" name="datetimepicker" class="input-append date"> <input type="text" class="form-control" id="stu_admissiondate" name="stu_admissiondate" style="height:30px; font-size:13px; width:245px;" tabindex="4" value="<?php echo $_POST['stu_admissiondate']?>"> <span class="add-on" style="height:30px;"><i data-time-icon="icon-time" data-date-icon="icon-calendar"></i></span> </div> <!-- if there is an error--> <div class="col-md-10" id="err_admissiondate" style="color:#990000;margin-left:-15px; display:none;"></div> <!--- end error--> </div> </div> <div class="form-group col-md-6" > <div class="col-md-5 text-right "> <b style="color:#666666;">Father Mobile2</b></div> <div class="col-md-7"> <input type="text" class="form-control" id="stu_fathermobile2" maxlength="10" name="stu_fathermobile2" style="height:29px;font-size:13px;" tabindex="14" value="<?php echo $_POST['stu_fathermobile2']?>"> <!-- if there is an error--> <div class="col-md-11" id="err_fathermobile2" style="color:#990000;margin-left:-15px; display:none;"></div> <!--- end error--> </div> </div> </div> <div class="class" > <div class="form-group col-md-6" style="clear:both;"> <div class="col-md-4 col-md-offset-1 text-right"> <b style="color:#666666;">Date of Birth</b><span style="color:#FF0000;">*</span> </div> <div class="col-md-7 "> <div id="datetimepicker2" name="datetimepicker2" class="input-append date"> <input type="text" class="form-control" id="stu_birthdate" name="stu_birthdate" style="height:30px; font-size:13px; width:245px;" tabindex="4" value="<?php echo $_POST['stu_birthdate']?>"> <span class="add-on" style="height:30px;"><i data-time-icon="icon-time" data-date-icon="icon-calendar"></i></span> </div> <!-- if there is an error--> <div class="col-md-10" id="err_admissiondate2" style="color:#990000;margin-left:-15px; display:none;"></div> <!--- end error--> </div> </div> <div class="form-group col-md-6" > <div class="col-md-5 text-right "> <b style="color:#666666;">Mother Name</b><span style="color:#FF0000;">*</span> </div> <div class="col-md-7"> <input type="text" class="form-control" id="stu_mothername" maxlength="50" name="stu_mothername" onblur="check_val(this.value)" style="height:29px;font-size:13px;" tabindex="15" value="<?php echo $_POST['stu_mothername']?>"> <!-- if there is an error--> <div class="col-md-10" id="err_mothername" style="color:#990000;margin-left:-15px; display:none;"></div> <!--- end error--> </div> </div> <div class="form-group col-md-6" style="margin-bottom:1.0%; clear:both;"> <div class="col-md-4 col-md-offset-1 text-right"> <b style="color:#666666;">Student Roll Number </b><span style="color:#FF0000;margin-left:-4px;">*</span> </div> <div class="col-md-7"> <input type="text" class="form-control" id="stu_rollnum" maxlength="20" name="stu_rollnum" style="height:29px;font-size:13px;" maxlength="50" tabindex="5" value="<?php echo $_POST['stu_rollnum']?>"> <!-- if there is an error--> <div class="col-md-10" id="err_studentrollnum" style="color:#990000;margin-left:-15px; display:none;"></div> <!--- end error--> </div> </div> <div class="form-group col-md-6" > <div class="col-md-5 text-right "> <b style="color:#666666;">Mother Email</b><span style="color:#FF0000; ">*</span> </div> <div class="col-md-7"> <input type="text" class="form-control" id="stu_motheremail" maxlength="50" name="stu_motheremail" style="height:29px;font-size:13px;" tabindex="16" value="<?php echo $_POST['stu_motheremail']?>"> <!-- if there is an error--> <div class="col-md-11" id="err_motheremail" style="color:#990000;margin-left:-15px; display:none;"></div> <!--- end error--> </div> </div> <div class="form-group col-md-6" style="margin-bottom:1.0%; clear:both;"> <div class="col-md-4 col-md-offset-1 text-right"> <b style="color:#666666;">Student First Name </b><span style="color:#FF0000;margin-left:-4px;">*</span> </div> <div class="col-md-7"> <input type="text" class="form-control" id="stu_firstname" maxlength="50" name="stu_firstname" style="height:29px;font-size:13px;" tabindex="6" value="<?php echo $_POST['stu_firstname']?>"> <!-- if there is an error--> <div class="col-md-10" id="err_stufirstname" style="color:#990000;margin-left:-15px; display:none;"></div> <!--- end error--> </div> </div> <div class="form-group col-md-6"> <div class="col-md-5 text-right "> <b style="color:#666666;">Mother Mobile</b><span style="color:#FF0000;">*</span> </div> <div class="col-md-7"> <input type="text" class="form-control" id="stu_mothermobile" maxlength="10" name="stu_mothermobile" style="height:29px;font-size:13px;" tabindex="17" value="<?php echo $_POST['stu_mothermobile']?>"> <!-- if there is an error--> <div class="col-md-11" id="err_mothermobile" style="color:#990000;margin-left:-15px; display:none;"></div> <!--- end error--> </div> </div> <div class="form-group col-md-6" style="margin-bottom:1.0%; clear:both;"> <div class="col-md-4 col-md-offset-1 text-right"> <b style="color:#666666;">Student Last Name </b><span style="color:#FF0000;margin-left:-4px;">*</span> </div> <div class="col-md-7"> <input type="text" class="form-control" id="stu_lastname" maxlength="50" name="stu_lastname" style="height:29px;font-size:13px;" tabindex="7" value="<?php echo $_POST['stu_lastname']?>"> <!-- if there is an error--> <div class="col-md-10" id="err_stulastname" style="color:#990000;margin-left:-15px; display:none;"></div> <!--- end error--> </div> </div> <div class="form-group col-md-6" > <div class="col-md-5 text-right "> <b style="color:#666666;">Mother Mobile2</b> </div> <div class="col-md-7"> <input type="text" class="form-control" id="stu_mothermobile2" maxlength="10" name="stu_mothermobile2" style="height:29px;font-size:13px;" tabindex="18" value="<?php echo $_POST['stu_mothermobile2']?>"> <!-- if there is an error--> <div class="col-md-11" id="err_mothermobile2" style="color:#990000;margin-left:-15px; display:none;"></div> <!--- end error--> </div> </div> <div class="form-group col-md-6" style="margin-bottom:1.0%; clear:both;"> <div class="col-md-4 col-md-offset-1 text-right"> <b style="color:#666666;">Student Address </b><span style="color:#FF0000;margin-left:-4px;">*</span> </div> <div class="col-md-7"> <textarea class="form-control" rows="3" id="stu_address" tabindex="9" maxlength="100" name="stu_address" style="margin: 0px;"><?php echo $_POST['stu_address']?></textarea> <!-- if there is an error--> <div class="col-md-10" id="err_stuaddress" style="color:#990000;margin-left:-15px; display:none;"></div> <!--- end error--> </div> </div> <div class="form-group col-md-6" > <div class="col-md-5 text-right "> <b style="color:#666666;">Guardian Name</b> </div> <div class="col-md-7"> <input type="text" class="form-control" maxlength="50" id="stu_gurdianname" onblur="check_val(this.value)" name="stu_gurdianname" style="height:29px;font-size:13px;" tabindex="19" value="<?php echo $_POST['stu_gurdianname']?>"> <!-- if there is an error--> <div class="col-md-10" id="err_stugurdianname" style="color:#990000;margin-left:-15px; display:none;"></div> <!--- end error--> </div> </div> <div class="form-group col-md-6" style="margin-bottom:1.0%;clear:both;"> <div class="col-md-4 col-md-offset-1 text-right"> <b style="color:#666666;">Student Blood Group</b> </div> <div class="col-md-7"> <select class="form-control" id="stu_blodgroup" name="stu_blodgroup" style="height:29px; font-size:12px;" tabindex="10"> <option selected="selected" value='0'>--Select Blood Group--</option> <?php $bldgrp=["A+","B+","O+","AB+","A-","B-","O-","AB-"]; if(isset($_POST['stu_blodgroup'])) { for($b=0;$b<count($bldgrp);$b++) if($_POST['stu_blodgroup']==$bldgrp[$b]) echo "<option value='".$bldgrp[$b]."' selected>".$bldgrp[$b]."</option>"; else echo "<option value='".$bldgrp[$b]."'>".$bldgrp[$b]."</option>"; } else { for($b=0;$b<count($bldgrp);$b++) echo "<option value='".$bldgrp[$b]."'>".$bldgrp[$b]."</option>"; } ?> </select> <!-- if there is an error--> <div class="col-md-10" id="err_blodgroup" style="color:#990000;margin-left:-15px; display:none;"></div> <!--- end error--> </div> </div> <div class="form-group col-md-6" > <div class="col-md-5 text-right "> <b style="color:#666666;">Guardian Email</b> </div> <div class="col-md-7"> <input type="text" class="form-control" maxlength="50" id="stu_gurdianemail" name="stu_gurdianemail" style="height:29px;font-size:13px;" tabindex="20" value="<?php echo $_POST['stu_gurdianemail']?>"> <!-- if there is an error--> <div class="col-md-11" id="err_gurdianemail" style="color:#990000;margin-left:-15px; display:none;"></div> <!--- end error--> </div> </div> <div class="form-group col-md-6" style="margin-bottom:1.0%; clear:both;"> <div class="col-md-4 col-md-offset-1 text-right"><b style="color:#666666;">Student Profile pic</b></div> <div class="col-md-7 topmargin"> <input type="file" class="form-control accept-image" id="profile_pic" name="profile_pic" style="height:29px;font-size:13px;padding-bottom:36px;margin-top:0px;width:100%" tabindex="18" value=""> <!-- if there is an error--> <div class="col-md-11" id="err_mothermobile2_pic" style="color:#990000;margin-left:-15px; display:none;"></div> <!--- end error--> </div> <div class="col-md-8 col-md-offset-4 text-right"> <img style="width:100px;height:100px;" class="img-preview hide" src="" /> </div> </div> </div> <script> function readURL(input) { if (input.files && input.files[0]) { var reader = new FileReader(); reader.onload = function (e) { console.log(e.target.result); $('.img-preview').attr('src', e.target.result); $('.img-preview').removeClass('hide'); } reader.readAsDataURL(input.files[0]); } } $(document).ready(function(){ $('.accept-image').change(function(){ var file = $(this).prop("files")[0]; re = /(\.jpg|\.jpeg|\.png)$/i; if(!re.exec(file.name)) { alert('Please Upload Valid Image File.'); $(this).removeProp('files'); $(this).val(''); } else { readURL(this); } }); }); </script> <div class="form-group col-md-6" style="margin-bottom:1.0%;"></div> <div class="form-group col-md-6" > <div class="col-md-5 text-right "> <b style="color:#666666;">Guardian Mobile</b> </div> <div class="col-md-7"> <input type="text" class="form-control" maxlength="10" id="stu_gurdianmobile" name="stu_gurdianmobile" style="height:29px;font-size:13px;" tabindex="21" value="<?php echo $_POST['stu_gurdianmobile']?>"> <!-- if there is an error--> <div class="col-md-11" id="err_gurdianmobile" style="color:#990000;margin-left:-15px; display:none;"></div> <!--- end error--> </div> </div> <div class="form-group col-md-6" > <div style="border:0px red solid;clear:both" class="col-md-4 col-md-offset-3"> <p class="chckStyle" style="margin-top: 0px;">Hostler <span><input type="checkbox" id="hostel" name="hostel" value="1" class="largerCheckbox" style="margin-top:1px;"> </span> <span><input type="hidden" id="hostel" name="hostel" value="0" class="largerCheckbox" style="margin-top:1px;"> </span> </p> </div> </div> <div class="form-group col-md-6" > <div class="col-md-5 text-right "> <b style="color:#666666;">Guardian Mobile2</b> </div> <div class="col-md-7"> <input type="text" class="form-control" id="stu_gurdianmobile2" maxlength="10" name="stu_gurdianmobile2" style="height:29px;font-size:13px;" tabindex="22" value="<?php echo $_POST['stu_gurdianmobile2']?>"> <!-- if there is an error--> <div class="col-md-11" id="err_guardianmobile2" style="color:#990000;margin-left:-15px; display:none;"></div> <!--- end error--> </div> </div> </div><!-- /.col --> </div><!-- /.row --> <div class="form-group"> <div class="col-md-12" align="center"> <button type="submit" class="btn btn-default custom-button-width .navbar-right btnclr" tabindex="23" style="font-family:Arial, Helvetica, sans-serif;font-style:normal;font-size:13px; margin:20px; " onclick="return inputvalidations()">Add</button> <button type="button" class="btn btn-default custom-button-width .navbar-right btnclr" tabindex="24" style="font-family:Arial, Helvetica, sans-serif;font-style:normal;font-size:13px; margin:20px; " onclick="return clearall()">Cancel</button> </div> <input type="hidden" name="action" id="action" value="add"> <input type="hidden" name="details_father" id="details_father" value=""> <input type="hidden" name="details_mother" id="details_mother" value=""> <input type="hidden" name="details_gaurdian" id="details_gaurdian" value=""> <input type="hidden" name="student_mails" id="student_mails" value=""> </form> </div> // <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> <script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> // <script type="text/javascript" src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/js/bootstrap.min.js"> </script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.15.1/moment.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.7.14/js/bootstrap-datetimepicker.min.js"></script> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.7.14/css/bootstrap-datetimepicker.min.css"> // <script type="text/javascript" src="http://tarruda.github.com/bootstrap-datetimepicker/assets/js/bootstrap-datetimepicker.min.js"></script> // <script type="text/javascript" src="http://tarruda.github.com/bootstrap-datetimepicker/assets/js/bootstrap-datetimepicker.pt-BR.js"></script> <script type="text/javascript"> $('#datetimepicker').datetimepicker({ format: 'dd/MM/yyyy', pickTime: false }).on('changeDate', function(){ $(this).datetimepicker('hide'); }); $('#datetimepicker2').datetimepicker({ format: 'dd/MM/yyyy', pickTime: false }).on('changeDate', function(){ $(this).datetimepicker('hide'); }); </script> <script type="text/javascript"> $('#datetimepicker1').datetimepicker({ format: 'dd/MM/yyyy', pickTime: false }).on('changeDate', function(){ $(this).datetimepicker('hide'); }); $("#classes").change(function() { if($(this).val() == 0) { var section_option = '<option value="0">--Select Section--</option>'; $("#sections").html(section_option); $('#err_class').text('Please Choose the Class'); return false; } else { var x = $(this).val(); $.ajax({ url: "ajaxcalls.php", type:"POST", data:"mode="+"choose_class"+"&data="+x, success: function(result) { var result2 = eval("("+result+")"); var section_option = '<option value="0">--Select Section--</option>'; for(var i = 0;i < result2.length;i++){ section_option += '<option value="'+result2[i].section_id+'">'+result2[i].section_name+'</option>'; } $("#sections").html(section_option); }, error : function(e) { } }); } }); function check_father_mail(fathermail) { $.ajax({ url: "ajaxcalls.php", type:"POST", data:"mode="+"checkfather_mail"+"&data="+fathermail, success: function(result) { } }); } </script> </body> </html>