File: /var/www/html/taxicamera/application/views/admin/user/edit.php
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<section class="content-header">
<h1> Edit User </h1>
</section>
<section class="content">
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<div class="box box-primary">
<form role="form" action="" class="" method="post" id="form_area" enctype="multipart/form-data" autocomplete="off">
<div class="box-body">
<?php if($this->session->flashdata('success_msg')):?>
<div class="alert alert-success">
<a href="#" class="close" data-dismiss="alert" aria-label="close" title="close">×</a>
<?php echo $this->session->flashdata('success_msg')?>
</div>
<?php endif?>
<?php if($this->session->flashdata('error_msg')):?>
<div class="alert alert-danger">
<a href="#" class="close" data-dismiss="alert" aria-label="close" title="close">×</a>
<?php echo $this->session->flashdata('error_msg')?>
</div>
<?php endif?>
<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">
<div class="form-group">
<label>First Name</label>
<input type="text" class="form-control" onkeypress="nospaces(this)" name="first_name" id="first_name" placeholder="First Name" value="<?php echo $user['first_name'];?>">
</div>
<?php echo form_error('first_name', '<div class="error">', '</div>'); ?>
</div>
<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">
<div class="form-group">
<label>Last Name</label>
<input type="text" class="form-control" onkeypress="nospaces(this)" name="last_name" id="last_name" placeholder="Last Name" value="<?php echo $user['last_name'];?>">
</div>
<?php echo form_error('last_name', '<div class="error">', '</div>'); ?>
</div>
<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">
<div class="form-group">
<label>Email Id</label>
<input type="email" class="form-control" onkeypress="nospaces(this)" name="email" id="email" readonly placeholder="Email Id" value="<?php echo $user['email'];?>">
</div>
<?php echo form_error('email', '<div class="error">', '</div>'); ?>
</div>
<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">
<div class="form-group">
<label>Phone No.</label>
<input type="text" class="form-control number_validation" onkeypress="nospaces(this)" readonly maxlength='10' name="phoneno" id="phoneno" placeholder="Phone No." value="<?php echo $user['phoneno'];?>">
</div>
<?php echo form_error('phoneno', '<div class="error">', '</div>'); ?>
</div>
<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">
<div class="form-group">
<label for="imgInp">Choose Profile Picture </label>
<input type="file" id="imgInp" name="imgInp">
</div>
<?php if(!empty($user['profile_image'])):?>
<img src="<?php echo base_url()?>uploads/user/<?php echo $user['profile_image']?>">
<?php endif?>
<?php echo form_error('imgInp', '<div class="error">', '</div>'); ?>
</div>
<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">
<button class="btn btn-success btn-md" type="submit">Update</button>
<a href="../" class="btn btn-danger btn-md" type="button">Cancel</a>
</div>
</div>
</form>
</div>
</div>
</div>
</section>
</div>
<script src="https://cdn.ckeditor.com/4.5.7/standard/ckeditor.js"></script>
<script>
// function readURL(input) {
// if (input.files && input.files[0]) {
// var reader = new FileReader();
// reader.onload = function (e) {
// $('#blah').attr('src', e.target.result);
// }
// reader.readAsDataURL(input.files[0]);
// }
// }
// $("#imgInp").change(function(){
// readURL(this);
// });
// CKEDITOR.replace('description');
// CKEDITOR.replace('content');
</script>
<script>
$(document).ready(function () {
//called when key is pressed in textbox
$(".number_validation").keypress(function (event) {
return validateFloatKeyPress(this,event);
});
});
function validateFloatKeyPress(el, evt) {
var charCode = (evt.which) ? evt.which : event.keyCode;
var number = el.value.split('.');
//alert(charCode);alert(number);
if (charCode != 46 && charCode > 31 && (charCode < 48 || charCode > 57)) {
return false;
}
//just one dot (thanks ddlab)
if(number.length>1 && charCode == 46){
return false;
}
//get the carat position
var caratPos = getSelectionStart(el);
var dotPos = el.value.indexOf(".");
if( caratPos > dotPos && dotPos>-1 && (number[1].length > 1)){
return false;
}
return true;
}
function getSelectionStart(o) {
if (o.createTextRange) {
var r = document.selection.createRange().duplicate()
r.moveEnd('character', o.value.length)
if (r.text == '') return o.value.length
return o.value.lastIndexOf(r.text)
}
else return o.selectionStart
}
function nospaces(t){
if(t.value.match(/\s/g) && t.value.length == 1){
alert('Sorry, you are not allowed to enter any spaces in the starting.');
t.value=t.value.replace(/\s/g,'');
}
}
</script>