0

After successfully Logged In to the system when click on edit profile button the profile is update and also database is update but the changes is not reflect on page.

public function editprofile()
        {
            $oActiveUser = $this->session->userdata ( 'member' );
            $iMemberId = $oActiveUser['member_id'];
            $aData['first_name'] = $this->input->post('fname');
            $aData['last_name']=$this->input->post('lname');
            $aData['email_id']=$this->input->post('emailid');
            $aData[ 'status'] = 'ACTIVE';
            $aWhere = array( 'member_id' => $iMemberId );
            $this->db_common->update( $this->sTable1 , $aData , $aWhere );
            $this->db_common->delete( $this->sTable3 , $aWhere );
            foreach($this->input->post('tech') as $technology) 
            {
                $data = array(
                    'member_id' => (int)$iMemberId,
                    'technology_id' => $technology
                 );
            $this->db_common->insert( $this->sTable3 , $data );
            $aResp = array( 'member_techno_id' => $this->db->insert_id());
            }
            redirect('front/Dashboard');

This is My View page of edit profile:-

<form class="form-horizontal style-form" method="post" action="<?php echo base_url();?>front/Profile/editprofile" name="frmprofile" id="frmprofile">
                    <input type="hidden" class="form-control" name="id" id="id" value="<?php echo $oActiveUser['member_id'];?>">
                          <div class="form-group">
                              <label class="col-sm-2 col-sm-2 control-label">First Name</label>
                              <div class="col-sm-10">
                                <input type="text" class="form-control required" name="fname" id="fname" value="<?php echo $oActiveUser['first_name'];?>">
                              </div>
                          </div>

                          <div class="form-group">
                              <label class="col-sm-2 col-sm-2 control-label">Last Name</label>
                              <div class="col-sm-10">
                                  <input type="text" class="form-control required" name="lname" id="lname" value="<?php echo $oActiveUser['last_name'];?>">
                              </div>
                          </div>

                          <div class="form-group">
                              <label class="col-sm-2 col-sm-2 control-label">Email Id</label>
                              <div class="col-sm-10">
                                  <input type="text" class="form-control required" name="emailid" id="emailid" value="<?php echo $oActiveUser['email_id'];?>">
                              </div>
                          </div>

                          <div class="form-group">
                              <label class="col-sm-2 col-sm-2 control-label">Technologies</label>
                              <div class="col-sm-10">
                                 <?php if(@$aTechCount>0){
                                    foreach( $aTechnology as $oType ){ ?>
                                      <li style="list-style-type:none;"><input type="checkbox" name="tech[]" value="<?php echo @$oType->technology_id; ?>" <?php if( in_array(@$oType->technology_id,$memTech)){ echo "checked";}?>> <?php echo strtoupper(@$oType->technology_name); } }?></li>
                              <span id="check_error" style="color:red;font-weight:bold;"></span>     
                              </div>
                          </div>

                          <center><input type="submit" class="btn btn-theme" name="upadate" id="update" value="Update" style="margin-bottom:5px;"><center>
                    </form> 

this is my edit profile code when i redirect to dashboard and again click on edit profile the updated data should not display in form.

This is My Edit profile controller loads view

public function index()
    {
        $oActiveUser = $this->session->userdata ( 'member' );
        $id = $oActiveUser['member_id'];
        $sQuery = $this->db->query("SELECT technology_id FROM `member_technology` WHERE member_id = '$id'")->result();
        $tech_array = array();
        foreach($sQuery as $jQry){
            $tech_array [] = $jQry->technology_id;
        }
        $aData['memTech'] = $tech_array;
        $aWhere[ 'member_id' ] = $id;
        $aData[ 'aTechnology' ] = $this->db_common->get_data();
        $aData[ 'aTechCount' ] = count( $aData[ 'aTechnology' ] );
        $this->load->view('front/header');
        $this->load->view('front/editprofile',$aData);
        $this->load->view('front/footer');
    }
1
  • where is your edit profile controller which loads view.
    – siddhesh
    Oct 26, 2015 at 10:10

1 Answer 1

0

I think this error occured due to this lines.

$this->load->view('front/header');
$this->load->view('front/editprofile',$aData);
$this->load->view('front/footer');

to avoid this you can remove below lines.

$this->load->view('front/header');
$this->load->view('front/footer');

load these view files in your

$this->load->view('front/editprofile',$aData);

view.

1
  • no this line not gives error. But the session is set when user is logged in So when I update the profile data update in database but not reflect on my form.
    – Kim Jones
    Oct 26, 2015 at 11:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.