I got this message while running my project
Severity: Warning Message: Missing argument 1 for ForgotPassword::FormEditPassword() Filename: controllers/ForgotPassword.php Line Number: 12 Backtrace: File: C:\xampp\htdocs\Telkom\application\controllers\ForgotPassword.php Line: 12 Function: _error_handler File: C:\xampp\htdocs\Telkom\index.php Line: 315 Function: require_once
A PHP Error was encountered Severity: Notice Message: Undefined variable: id_user Filename: controllers/ForgotPassword.php Line Number: 14 Backtrace: File: C:\xampp\htdocs\Telkom\application\controllers\ForgotPassword.php Line: 14 Function: _error_handler File: C:\xampp\htdocs\Telkom\index.php Line: 315 Function: require_once
Here's my controller
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class ForgotPassword extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->model('m_forgotpassword');
}
public function FormEditPassword($id_user)
{
$data['akun']=$this->m_forgotpassword->get_data_selected($id_user)->result();
$this->load->view("forgotpassword", $data);
}
public function AksiEditPassword()
{
$this->m_forgotpassword->EditDataPasword();
redirect(base_url('index.php/login'));
}
}
Here's my model
<?php
/**
*
*/
class m_forgotpassword extends CI_Model
{
function EditDataPassword()
{
$data = array(
'email' => $this->input->post("email"),
'password' => $this->input->post("password"),
);
$this->db->where("id_user",$this->input->post("id_user"));
$this->db->update("akun",$data);
}
function get_data_selected($id_user)
{
$this->db->where("id_user",$id_user);
return $this->db->get("akun");
}
}
?>
And here's my view
<head>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
<link href="<?php echo base_url() ?>assets/css/login.css" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<link rel="icon" type="image/png" href="<?php echo base_url() ?>assets/img/icon.png">
<title>TELKOM - PT. Telekomunikasi Indonesia Tbk</title>
</head>
<body>
<div class="main">
<div class="container">
<center>
<div class="middle">
<div id="login">
<?php
echo form_open_multipart("forgotpassword/AksiEditPassword", array("class"=>"form-horizontal"));
foreach ($akun as $a) {
echo form_input(array("name" => "email",
"value" => $a->email,
"class" => "form-control",
"placeholder" => "Email",
"type" => "text"));
echo form_input(array("name" => "password",
"value" => $a->password,
"class" => "form-control",
"placeholder" => "New Password",
"type" => "text"));
echo form_input(array("name" => "id_user",
"value" => $a->id_user,
"type" => "hidden"));
echo form_input(array("class" => "btn btn-success",
"type" => "submit",
"value" => "Submit"));
}
?>
<span style="width:50%; text-align:right; display: inline-block;"><a class="small-text" href="<?php echo base_url('index.php/login')?>">Cancel</a></span>
</div> <!-- end login -->
<div class="logo">
<img src="<?php echo base_url('assets/img/logo2.png')?>" style="margin-left: 50px; width: 300px; height: 150px;">
<div class="clearfix"></div>
</div>
</div>
</center>
</div>
</div>
</body>
FormEditPassword($id_user = '')
– Mr. ED$id_user
is the required argument but its missing tats the error change it topublic function FormEditPassword($id_user = NULL)
– Arun pandian M