简体   繁体   中英

codeigniter profile page edit

I want to make a profile page edit for my project. I try something to profile page. But I gave an error.

How can I do profile page ? The error is:

An uncaught Exception was encountered
Type: ArgumentCountError

Message: Too few arguments to function CProfile_edit::update(), 0 passed in C:\xampp\htdocs\erp\system\core\CodeIgniter.php on line 532 and exactly 1 expected

Filename: C:\xampp\htdocs\erp\application\controllers\CProfile_edit.php

Line Number: 14

Backtrace:

File: C:\xampp\htdocs\erp\index.php
Line: 315
Function: require_once

I gave it always. I use session data for take data from customer table. But I can not profile edit. I take this error.

This is my view:

<section class="panel">
                    <div class="bio-graph-heading">
                        <?php echo $this->lang->line('profile_edit_top_text'); ?>
                    </div>
                    <div class="panel-body bio-graph-info">
                        <h1> <?php echo $this->lang->line('profile_edit_text_informations'); ?></h1>
                        <form class="form-horizontal" role="form" method="post" action="<?php echo base_url("CProfile_edit/update/$user->cosId"); ?>">
                            <!-- Form -->
                            <div class="form-group">
                                <label  class="col-lg-2 control-label"><?php echo $this->lang->line('cprofile_profile_username'); ?></label>
                                <div class="col-lg-6">
                                    <input type="text" class="form-control" id="f-name" name="cosUserName" placeholder="<?php echo $this->session->userdata('people_username'); ?>" />
                                </div>
                            </div>
                            <!-- Form -->
                            <div class="form-group">
                                <label  class="col-lg-2 control-label"><?php echo $this->lang->line('cprofile_profile_email'); ?></label>
                                <div class="col-lg-6">
                                    <input type="email" class="form-control" id="email" name="cosEmail" placeholder="<?php echo $this->session->userdata('people_email'); ?>" />
                                </div>
                            </div>
                            <!-- Form -->
                            <div class="form-group">
                                <label  class="col-lg-2 control-label"><?php echo $this->lang->line('cprofile_profile_firstname'); ?></label>
                                <div class="col-lg-6">
                                    <input type="text" class="form-control" id="f-name" name="cosName" placeholder="<?php echo $this->session->userdata('people_username'); ?>" />
                                </div>
                            </div>
                            <!-- Form -->
                            <div class="form-group">
                                <label  class="col-lg-2 control-label"><?php echo $this->lang->line('cprofile_profile_lastname'); ?></label>
                                <div class="col-lg-6">
                                    <input type="text" class="form-control" id="l-name" name="cosSurname" placeholder="<?php echo $this->session->userdata('people_surname'); ?>" />
                                </div>
                            </div>
                            <!-- Form -->
                            <div class="form-group">
                                <label  class="col-lg-2 control-label"><?php echo $this->lang->line('cprofile_profile_phone'); ?></label>
                                <div class="col-lg-6">
                                    <input type="text" class="form-control" id="f-name" name="cosPho" placeholder="<?php echo $this->session->userdata('people_phone'); ?>" />
                                </div>
                            </div>
                            <!-- Form -->
                            <div class="form-group">
                                <label  class="col-lg-2 control-label"><?php echo $this->lang->line('cprofile_profile_mobile'); ?></label>
                                <div class="col-lg-6">
                                    <input type="text" class="form-control" id="f-name" name="cosGsm" placeholder="<?php echo $this->session->userdata('people_mobile'); ?>" />
                                </div>
                            </div>
                            <!-- Basic select -->
                            <div class="form-group">
                                <label class="control-label col-lg-3"><?php echo $this->lang->line('cprofile_profile_lang'); ?> <span class="text-danger">*</span></label>
                                <div class="col-lg-9">
                                    <select name="cosLang" class="form-control">
                                        <option value="<?php echo $this->session->userdata('people_lang'); ?>"><?php echo $this->session->userdata('people_lang'); ?></option>
                                        <option value="en">English</option>
                                        <option value="ar">Arabic</option>
                                    </select>
                                </div>
                            </div>
                            <!-- /basic select -->
                            <div class="form-group">
                                <div class="col-lg-offset-2 col-lg-10">
                                    <button type="submit" class="btn btn-success">Save</button>
                                    <button type="button" class="btn btn-default">Cancel</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </section>

There is my controller:

 <?php
defined('BASEPATH') OR exit('No direct script access allowed');

class CProfile_edit extends CI_Controller {

    public function index()
    {
        //redirect(base_url('calendar'));
        $this->lang->load('content', $this->session->userdata('people_lang'));
        $this->load->view('cprofile_edit');
    }


    public function update($cusId = 1)
    {
        if (! empty($cusId))
        {
            $data = array (
                "cosUserName" => $this->input->post("cosUserName"),
                "cosEmail" => $this->input->post("cosEmail"),
                "cosName" => $this->input->post("cosName"),
                "cosSurname" => strtoupper($this->input->post("cosSurname")),
                "cosPho" => $this->input->post("cosPho"),
                "cosGsm" => $this->input->post("cosGsm"),
                "cosLang" => $this->input->post("cosLang"),
                "cosEditDate" => date('Y-m-d H:i:s')
            );

            $update = $this->db->where("cusId", $cusId)->update("customer", $data);
            if($update)
            {
                redirect(base_url("cprofile"));
            }
            else
            {
                echo "Hata!";
            }
        }
    }


}
?>

Line Number: 14 error: public function update($cusId) {

Edit Your View and use this code.

               <section class="panel">
                    <div class="bio-graph-heading">
                        <?php echo $this->lang->line('profile_edit_top_text'); ?>
                    </div>
                    <div class="panel-body bio-graph-info">
                        <h1> <?php echo $this->lang->line('profile_edit_text_informations'); ?></h1>
                        <form class="form-horizontal" role="form" method="post" action="<?php echo base_url("CProfile_edit/update/".$this->session->userdata('people_id')); ?>">
                            <!-- Form -->
                            <div class="form-group">
                                <label  class="col-lg-2 control-label"><?php echo $this->lang->line('cprofile_profile_username'); ?></label>
                                <div class="col-lg-6">
                                    <input type="text" class="form-control" id="f-name" name="cosUserName" placeholder="<?php echo $this->session->userdata('people_username'); ?>" />
                                </div>
                            </div>
                            <!-- Form -->
                            <div class="form-group">
                                <label  class="col-lg-2 control-label"><?php echo $this->lang->line('cprofile_profile_email'); ?></label>
                                <div class="col-lg-6">
                                    <input type="email" class="form-control" id="email" name="cosEmail" placeholder="<?php echo $this->session->userdata('people_email'); ?>" />
                                </div>
                            </div>
                            <!-- Form -->
                            <div class="form-group">
                                <label  class="col-lg-2 control-label"><?php echo $this->lang->line('cprofile_profile_firstname'); ?></label>
                                <div class="col-lg-6">
                                    <input type="text" class="form-control" id="f-name" name="cosName" placeholder="<?php echo $this->session->userdata('people_username'); ?>" />
                                </div>
                            </div>
                            <!-- Form -->
                            <div class="form-group">
                                <label  class="col-lg-2 control-label"><?php echo $this->lang->line('cprofile_profile_lastname'); ?></label>
                                <div class="col-lg-6">
                                    <input type="text" class="form-control" id="l-name" name="cosSurname" placeholder="<?php echo $this->session->userdata('people_surname'); ?>" />
                                </div>
                            </div>
                            <!-- Form -->
                            <div class="form-group">
                                <label  class="col-lg-2 control-label"><?php echo $this->lang->line('cprofile_profile_phone'); ?></label>
                                <div class="col-lg-6">
                                    <input type="text" class="form-control" id="f-name" name="cosPho" placeholder="<?php echo $this->session->userdata('people_phone'); ?>" />
                                </div>
                            </div>
                            <!-- Form -->
                            <div class="form-group">
                                <label  class="col-lg-2 control-label"><?php echo $this->lang->line('cprofile_profile_mobile'); ?></label>
                                <div class="col-lg-6">
                                    <input type="text" class="form-control" id="f-name" name="cosGsm" placeholder="<?php echo $this->session->userdata('people_mobile'); ?>" />
                                </div>
                            </div>
                            <!-- Basic select -->
                            <div class="form-group">
                                <label class="control-label col-lg-3"><?php echo $this->lang->line('cprofile_profile_lang'); ?> <span class="text-danger">*</span></label>
                                <div class="col-lg-9">
                                    <select name="cosLang" class="form-control">
                                        <option value="<?php echo $this->session->userdata('people_lang'); ?>"><?php echo $this->session->userdata('people_lang'); ?></option>
                                        <option value="en">English</option>
                                        <option value="ar">Arabic</option>
                                    </select>
                                </div>
                            </div>
                            <!-- /basic select -->
                            <div class="form-group">
                                <div class="col-lg-offset-2 col-lg-10">
                                    <button type="submit" class="btn btn-success">Save</button>
                                    <button type="button" class="btn btn-default">Cancel</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </section>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM