Codeigniter Tutorials
- What is codeigniter?
- Application_Architecture
- MVC Architecture
- HMVC Architecture
- Codeigniter Configuration
- Remove index.php from url in codeigniter
- MVC Concept
- View
- Alternate PHP Syntax for View Files
- Routing
- Codeigniter URL
- Get Current URL
- Previous page URL get
- Seo Friendly URL
- Slug Create in codeigniter
- What is _remap() function
- Remove controller name from url in codeigniter
- Codeigniter Controller Class
- Class Constructor
- GET $ POST method in Codeigniter
- Models
- Basepath, Apppath, FCPATH
- URI Segment
- Page Redirect
- Helper class
- Custom Helper class
- Form Helper
- Common Helper Functions
- Common Function
- Array Problems
- Call controller in Helper
- Add active class to menu using Helper class
- Custom Library
- Custom Library Example
- when to use get_instance()
- Codeigniter Hook
- how to work inline css in codeigniter
- Custom 404 page
- 404 custom error page
- Create custom config file in codeigniter
- How to set and get config item value
- How to Speed Up CodeIgniter App?
- Codeigniter Functions
- Session
- cookies
- How to Set & Get Tempdata in Codeigniter
- flash messages in Codeigniter
- Flashdata
- Encryption and Decryption In CodeIgniter
- Codeigniter security
- csrf token form security
- Password Hashing
- Form Validation
- Custom Validation
- Registration Form with validation
- Server Side Form Validation
- Validate Select Option Field
- Date Format Validation
- Date Format change in codeigniter
- Date Functions
- DOB Validation
- CI CRUD
- User SignUp
- User Login
- User Logout
- Login Account
- Login form with RememberMe
- Login Form with session
- User change password
- Change Password with Callback Validation to Check Old Password
- Forgot password
- Reset password
- Insert data in database
- Fetch data from database
- Update data in database
- Delete data in database
- File Upload
- Image Upload with resize Image
- Upload Multiple file and images
- Upload Multiple images with CRUD
- File and image update
- Upload Image Using Ajax.
- Email Send
- Email Send Using Email library
- Email Send Using SMTP Gmail
- Notification send
- store data in json format in DB
- Json parse
- Fetch data Using Ajax with Json data
- How to Show data Using Ajax with Json parse
- Get JSON Data from PHP Script using jQuery Ajax
- Insert data Using Ajax
- Submit data Using Ajax with form validation
- How to show data Using Ajax in codeigniter
- Insert & Update Using Ajax
- Registration Form With Validation Using Ajax in codeigniter
- Delete data Using Ajax Confirmation
- Delete All data Using checkbox selection
- Ajax CSRF Token
- Ajax Post
- Ajax serverside form validation
- Contact form using AJAX with form validation
- DataTable Using Ajax dynamically
- DataTables pagination using AJAX with Custom filter
- DataTables AJAX Pagination with Search and Sort in codeigniter
- DataTables in Codeigniter using Ajax
- Ajax Custom Serarch
- Ajax Live Data Search using Jquery PHP MySql
- Ajax Custom Serarch and sorting in datatable
- Dynamic Search Using Ajax
- Autocomplete using jquery ajax
- Jquery Ajax Autocomplete Search using Typeahead
- Dynamic Dependent Dropdown Using Ajax
- Dynamic Dependent Dropdown list Using Ajax
- Dynamic Dependent Dropdown in codeigniter using Ajax
- ajax username/email availability check using JQuery
- Check Email Availability Using Ajax
- Data Load on mouse scroll
- Ajax CI Pagination
- Pagination in codeigniter
- Ajax Codeigniter Pagination
- email exists or not using ajax with json
- CRUD using AJAX With Modal popup in CI
- Add / Show Data on modal popup using Ajax
- Modal popup Validation using Ajax
- Data show on Modal popup Using Ajax
- Add / Remove text field dynamically using jquery ajax
- How to Add/Delete Multiple HTML Rows using JavaScript
- Delete Multiple Rows using Checkbox
- Multiple Checkbox value
- Form submit using jquery Example
- REST & SOAP API
- Multi-Language implementation in CodeIgniter
- How to pass multiple array in view
- Captcha
- create zip file and download
- PhpOffice PhpSpreadsheet Library (Export data in excel sheet)
- data export in excel sheet
- Excel File generate in Codeigniter using PHPExcel
- Dompdf library
- tcpdf library
- Html table to Excel & docs download
- CI Database Query
- Database Query
- SQL Injection Prevention
- Auth Model
- Join Mysql
- Tree View in dropdown option list
- OTP Integration in codeigniter
- curl post
- download file using curl
- Sweet Alert
- Sweet alert Delete & Success
- Log Message in Codeigniter
- Menu & Submenu show dynamically
- Set Default value in input box
- Cron Jobs
- Stored Procedure
- Display Loading Image when AJAX call is in Progress
- Send SMS
- IP Address
- Codeigniter Tutorialspoint
- Website Link
- How To Create Dynamic Xml Sitemap In Codeigniter
- Paypal Payment Integration
- Get Latitude and Longitude From Address in Codeigniter Using google map API
- How To Create Simple Bar Chart In Codeigniter Using AmCharts?
- dynamic Highcharts in Codeigniter
- Barcode in Codeigniter
- Codeigniter Interview Questions
- Project
Home » Codeigniter »
User Details update with image or file.
view File
if user is not select image upload then old image name update.
File Name :
<!-- PAGE CONTENT -->
<div class="page-content">
<!-- START X-NAVIGATION VERTICAL -->
<ul class="x-navigation x-navigation-horizontal x-navigation-panel">
<!-- TOGGLE NAVIGATION -->
<li class="xn-icon-button"><a href="#" class="x-navigation-minimize"><span
class="fa fa-dedent"></span></a></li>
<!-- END TOGGLE NAVIGATION -->
<!-- SEARCH -->
<li class="xn-search">
<form role="form">
<input type="text" name="search" placeholder="Search..." />
</form>
</li>
<!-- END SEARCH -->
<!-- SIGN OUT -->
<li class="xn-icon-button pull-right"><a href="#" class="mb-control"
data-box="#mb-signout"><span class="fa fa-sign-out"></span></a></li>
<!-- END SIGN OUT -->
</ul>
<!-- END X-NAVIGATION VERTICAL -->
<!-- START BREADCRUMB -->
<ul class="breadcrumb">
<li><a href="#">Home</a></li>
<li class="active">Edit Leaders</li>
</ul>
<!-- END BREADCRUMB -->
<div class="page-title">
<h2>Edit Leader Details</h2>
</div>
<!-- PAGE CONTENT WRAPPER -->
<div class="page-content-wrap">
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-body" id="refresh">
<div class="row">
<center>
<div style="color: red;"><?php //echo validation_errors(); ?></div>
</center>
<h3 class='flashMsg flashSuccess' style="color: green;"> <?=$this->session->flashdata('msg')?> </h3>
<h3 class='flashMsg flashSuccess' style="color: green;"> <?php //echo $error;?> </h3>
<?php foreach ($editleader as $row) { ?>
<form class="form-horizontal" action="<?php echo base_url();?>admin/addleaderinfo/update_leader_info/<?php echo $row->id;?>" method="post" name="frm" id="frm" enctype="multipart/form-data">
<div class="col-md-6">
<div class="form-group">
<label class="col-md-3 control-label"> Name</label>
<div class="col-md-9">
<div class="input-group">
<span class="input-group-addon"><span class="fa fa-pencil"></span></span>
<input type="text" class="form-control" name="name" value="<?php echo $row->candidate_name;?>"/>
</div>
<span class="help-block" style="color: red;"><?php echo form_error('name'); ?></span>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Party Name</label>
<div class="col-md-9">
<div class="input-group">
<span class="input-group-addon"><span class="fa fa-pencil"></span></span>
<input type="text" class="form-control" name="partyname" value="<?php echo $row->party_name;?>"/>
</div>
<span class="help-block" style="color: red;"><?php echo form_error('partyname'); ?></span>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Email</label>
<div class="col-md-9">
<div class="input-group">
<span class="input-group-addon"><span class="fa fa-pencil"></span></span>
<input type="text" class="form-control" name="email" value="<?php echo $row->email;?>"/>
</div>
<span class="help-block" style="color: red;"><?php echo form_error('email'); ?></span>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Date Of Birth</label>
<div class="col-md-9">
<div class="input-group">
<span class="input-group-addon"><span class="fa fa-calendar"></span></span>
<input type="text" class="form-control datepicker"
name="dob" value="<?php echo $row->dob;?>">
</div>
<span class="help-block" style="color: red;"><?php echo form_error('dob'); ?></span>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Gender</label>
<div class="col-md-9">
<div class="input-group">
<input type="text" class="form-control" name="gender" value="<?php echo $row->gender;?>"/>
</div>
<span class="help-block" style="color: red;"><?php echo form_error('gender'); ?></span>
</div>
</div>
<<div class="form-group">
<label class="col-md-3 control-label">Leader Image</label>
<div class="col-md-9">
<div class="input-group">
<span class="input-group-addon"><span class="fa fa-pencil"></span></span>
<input type="file" class="form-control" name="candidate_image" id="candidate_image"/>
<input type="hidden" name="old_image_name" id="old_image_name" value="<?php echo $row->candidate_image;?>"/>
</div>
<span class="help-block" style="color: red;"><?php echo form_error('filename'); ?></span>
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="col-md-3 control-label">Vote</label>
<div class="col-md-9">
<div class="input-group">
<span class="input-group-addon"><span class="fa fa-pencil"></span></span>
<input type="text" class="form-control" id="vote" name="vote" value="<?php echo $row->vote_count;?>"/>
</div>
<span class="help-block" style="color: red;"><?php echo form_error('vote'); ?></span>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Mobile No</label>
<div class="col-md-9">
<div class="input-group">
<span class="input-group-addon"><span class="fa fa-pencil"></span></span>
<input type="text" class="form-control" name="mob" value="<?php echo $row->mobile;?>"/>
</div>
<span class="help-block" style="color: red;"><?php echo form_error('mob'); ?></span>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Qualification</label>
<div class="col-md-9">
<input type="text" class="form-control" name="qualification" id="qualification " value="<?php echo $row->qualification ;?>"/>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">State</label>
<div class="col-md-9">
<input type="text" class="form-control" name="state" id="state " value="<?php echo $row->state ;?>"/>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Details</label>
<div class="col-md-9 col-xs-12">
<textarea class="form-control" rows="6" name="details" value="<?php echo $row->details;?>"><?php echo $row->details;?></textarea>
<span class="help-block" style="color: red;"><?php echo form_error('details'); ?></span>
</div>
</div>
</div>
<div class="panel-footer">
<!-- <button class="btn btn-default">Clear Form</button> -->
<!-- <button class="btn btn-primary pull-right" name="submit" >Submit</button>-->
<br />
<center>
<input type="submit" name="submit" value="Submit"/>
</center>
</div>
</form>
<?php }?>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- END PAGE CONTENT WRAPPER -->
</div>
<!-- END PAGE CONTENT -->
</div>
<!-- END PAGE CONTAINER -->
<!-- MESSAGE BOX-->
<div class="message-box animated fadeIn" data-sound="alert"
id="mb-signout">
<div class="mb-container">
<div class="mb-middle">
<div class="mb-title">
<span class="fa fa-sign-out"></span> Log <strong>Out</strong> ?
</div>
<div class="mb-content">
<p>Are you sure you want to log out?</p>
<p>Press No if youwant to continue work. Press Yes to logout current
user.</p>
</div>
<div class="mb-footer">
<div class="pull-right">
<a href="<?php echo base_url('Logout');?>"
class="btn btn-success btn-lg">Yes</a>
<button class="btn btn-default btn-lg mb-control-close">No</button>
</div>
</div>
</div>
</div>
</div>
<!-- END MESSAGE BOX-->
Controller function
public function update_leader_info()
{
//$id = $this->input->post('id');
$id = $this->uri->segment(4);
$old_image_name = $this->input->post('old_image_name');
if ($_FILES['candidate_image']['name']!='')
{
if($old_image_name !='')
{
$dirPath = './assets/images/'.$old_image_name;
if($old_image_name !='')
{
unlink(realpath($dirPath));
}
}
$config['upload_path'] = './assets/images/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '1024';
$config['max_width'] = '1024';
$config['max_height'] = '768';
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload($field='candidate_image'))
{
$error = array('error' => $this->upload->display_errors());
$this->session->set_flashdata('msg', $error['error']);
$this->load->view('admin_views/addleaderinfo', $error);
}
else
{
$data = $this->upload->data();
$image_name = $data['file_name'];
}
}
else
{
$image_name= $old_image_name;
}
$data = array(
'candidate_name' => $this->input->post('name'),
'party_name ' => $this->input->post('partyname'),
'email' => $this->input->post('email'),
'dob'=> $this->input->post('dob'),
'gender' => $this->input->post('gender'),
'mobile' => $this->input->post('mob'),
'qualification'=> $this->input->post('qualification'),
'state'=> $this->input->post('state'),
'details'=> $this->input->post('details'),
'vote_count' => $this->input->post('vote'),
'candidate_image' => $image_name
);
$this->Admin_model->upd_leader_info($data,$id);
$this->session->set_flashdata('msg', '<div class="alert alert-danger text-center">Your data is successfully submited.</div>');
redirect('admin/Leaderdetails');
}