JezK
Edit File: addnew.php
<?php include_once("./app/checkSession.php"); if(empty($_SESSION['user_id'])&& $_SESSION['user_id']=='') { header("Location: ../owner_login.php"); } // if($_SESSION['role'] != 1) // { // header("Location: dashboard.php"); // } include('header.php'); $admin_details=$wareHouseAdminObj->fetchLoginAdminDetails($_SESSION['user_id']); ?> <link rel="stylesheet" href="css/newcontact.css"> <div class="container px-4"> <a href="javascript:history.go(-1)" class="ml-3"><img src="images/back_main.png" class="mb-3"></a> <div class="container mb-5"> <!--Add new head--> <div class="tophead"> <h6><?php echo $lang['ADD_NEW_CONTACT'];?></h6> </div> </div> <!--End of Add new Head--> <!--start of add new contact form--> <div class="container"> <!--Starting of add form--> <form method="post" action="app/add-subadmin.php"> <input type="hidden" name="companyId" value="<?php echo $admin_details['company_id'] ?>"> <div class="row"> <div class="col-md-6 col-lg-3 col-sm-12 "> <div class="form-group"> <label for=""><?php echo $lang['FIRST_NAME'];?></label> <input type="text" id="first_name" class="form-control" placeholder="Enter your First Name" name="first_name" onkeyup="return checkLengthwarehouse(this.value,'1');"> <div class="error first_name_error"></div> </div> </div> <div class="col-md-6 col-lg-3 col-sm-12"> <div class="form-group"> <label for="last_name"><?php echo $lang['LAST_NAME'];?></label> <input type="text" id="last_name" class="form-control" placeholder="Enter your Last Name" name="last_name" onkeyup="return checkLengthwarehouse(this.value,'2');"> <div class="error last_name_error"></div> </div> </div> <div class="col-md-6 col-lg-3 col-sm-12"> <div class="form-group"> <label for="email"><?php echo $lang['EMAIL'];?></label> <input type="email" id="email" class="form-control" placeholder="Enter your Email" name="email" onchange="return checkExistsOrNotcon(this.value,'2');"> <div class="error email_error"></div> </div> </div> <div class="col-md-6 col-lg-3 col-sm-12"> <div class="form-group"> <label for="country"><?php echo $lang['COUNTRY'];?></label> <select class="form-control" name="country" id="country" onchange="getcity(this.value);"> <option value=''><?php echo $lang['SELECT_COUNTRY'] ?></option> <?php $countryList=$wareHouseAdminObj->getCountryList(); $optionData=''; foreach($countryList as $val) { // $optionData.= '<option value='.$val['country_id'].'>'.$val['country_name'].'</option>'; $optionData.= '<option value="'.$val['country_id'].'"'; if($admin_details['country_id'] == $val['country_id']){ $optionData.= 'selected '; } $optionData.='>'.$lang[$val['lang_variables']].'</option>'; } ?> <?php echo "$optionData" ?> </select> <div class="error country_error"></div> </div> </div> <?php $cityList=$wareHouseAdminObj->getCityList($admin_details['country_id']); $optionData=''; foreach($cityList as $val) { $optionData.= '<option value="'.$val['city_name'].'"'; if($admin_details['city_name'] == $val['city_name']){ $optionData.= 'selected '; } $optionData.='>'.$lang[$val['lang_variables']].'</option>'; } ?> <div class="col-md-6 col-lg-3 col-sm-12"> <div class="form-group"> <label for="city"><?php echo $lang['CITY'];?></label> <!-- <input type="text" id="city" class="form-control" placeholder="Enter your city" name="city"> --> <select name="city" id="city" class="form-control frm-input"> <option value=""><?php echo $lang['SELECT_CITY'] ?></option> <?= $optionData;?> </select> <div class="error city_error"></div> </div> </div> <div class="col-md-6 col-lg-3 col-sm-12 "> <label for="inputPhone" class="inpt-label"><?php echo $lang['COUNTRY_CODE'];?></label> <div class="input-container"> <select id="mobile_country_code" name="mobile_country_code" class="form-control frm-input" required> <option value="966" <?php if($admin_details['mobile_country_code'] == '966'){ ?> selected <?php } ?>>+966</option> <option value="971" <?php if($admin_details['mobile_country_code'] == '971'){ ?> selected <?php } ?>>+971</option> <option value="962" <?php if($admin_details['mobile_country_code'] == '962'){ ?> selected <?php } ?>>+962</option> </select> </div> </div> <div class="col-md-6 col-lg-3 col-sm-12"> <div class="form-group"> <label for="mobile"><?php echo $lang['MOBILE_NUMBER'];?></label> <!-- <input type="text" id="mobile" class="form-control" placeholder="Enter your mobile number" name="mobile" value="<?php echo $admin_details['mobile_number']; ?>" onchange="return checkExistsOrNot(this.value,'3');" onkeypress="return checkPhone(event)"> --> <input type="text" id="mobile" class="form-control" placeholder="Enter your Phone Number" name="mobile" value="" onblur="return checkExistsOrNotcon2(this.value,'3');" onkeypress="return checkPhone(event)" onchange="check();" required> <div class="error mobile_error"></div> <!-- <div class="mobile_error" style="color: red;"></div> --> </div> </div> <div class="col-md-6 col-lg-3 col-sm-12"> <div class="form-group"> <label for="date"><?php echo $lang['INACTIVE_DATE'];?></label> <?php // echo $editdata['inactive_date']; ?> <div class="position-relative"> <input type="text" id="datepicker" name="inactiveDate" class="form-control frm-input" placeholder="<?php echo $admin_details['inactive_date'] ?>" value=""> <!-- <img src="./images/calender.png" class="calenderIcon" /> --> </div> </div> </div> <div class="button-add col-md-12 text-center"> <input class="btn btn-primary px-4 w-auto box-text" name="addWarehouseSubAdmin" value="<?php echo $lang['ADD'] ?>" type="submit" onclick="return validateSubAdmin_addnew();" id="submit"> </div> </form> <!--End of add form--> </div> </div> </div> <?php include("footer.php"); ?> <script type="text/javascript" src="js/validations.js?x=1"></script> <script type="text/javascript" src="../js/validations.js?x=2"></script> <script type="text/javascript"> function getcity(country_id) { $.ajax({ type: "POST", url: './ajax.php', data: ({ action: 'get_cities_list', country_id: country_id }), success: function(data) { $('#city').html(data); } }); } jQuery('#datepicker').datetimepicker({ defaultDate: '', format: 'YYYY-MM-DD', minDate: new Date() }); (function($) { var optionsDate = $.extend({}, { format: 'DD-MM-YYYY' }); $(document).ready(function() { $('#datepicker').datetimepicker(optionsDate); }); })(jQuery); function check(){ // alert("Hello"); var mobileNum=document.getElementById('mobile').value; if(mobileNum.length<8 || mobileNum.length>15){ $('.mobile_error').html('Phone number must be Minimum 8 digits to 15 digits Maximum'); document.getElementById('mobile').value=''; document.getElementById('mobile').focus(); return false; } } </script> </body> </html>