Welcome Guest, Not a member yet? Register   Sign In
$form_validation : error ??
#1

[eluser]Unknown[/eluser]
Hello all,

I spent last two days to find the answer. Thanks so much for your help.

Error message is :


A PHP Error was encountered

Severity: Notice

Message: Undefined property: Mlogin::$form_vaidation

Filename: controllers/mlogin.php

Line Number: 34




Code:
<?php

class Mlogin extends CI_Controller
{
public function __construct()

{
  parent::__construct();
  $this->load->helper(array('form','url'));
  $this->load->library('form_validation');
  $this->load->database();
  $this->output->enable_profiler(TRUE);
  
}

public function index($msg = NULL)
{
  
  $data['msg'] = $msg ;
  
  
  $this->load->view('login_view', $data);
  
  
}

public function login_process($msg = NULL)
{
  $this->load->helper(array('form','url'));
  $this->load->library('form_validation');

  $data['msg'] = $msg ;
  
  $this->form_vaidation->set_rules('username','username','required');
  $this->form_vaidation->set_rules('password','password','required');
  
  
  if ($this->form_validation->run() == False )
  {
   $this->load->view('login_view', $data);
  }
  else
  {
   $this->load->view('login_view', $data);
  }
}



  
}

?>

<html>
<head>
<title>Gestion des statistiques vacances</title>
<style type="text/css">
h5 {
  font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
  font-size: 8pt;
  color: DarkOrange;
  padding-top: 3px;
  padding-bottom: 0px;
}




h1 {
     font: bold 330%/100% "Lucida Grande";
     position: relative;
     color: #464646;
}

h1 span {
     background: url(gradient.png) repeat-x;
     position: absolute;
     display: block;
     width: 100%;
     height: 31px;
}

</style>

<h1><span></span>Login</h1>  
&lt;/head&gt;

&lt;body&gt;

&lt;?php echo validation_errors(); ?&gt;

&lt;?php echo form_open('mlogin/login_process'); ?&gt;

&lt;?php if(! is_null($msg)) echo $msg; ?&gt;

&lt;!-- ********************************************************************************************************* --&gt;

</br>
<h5>Nom</h5>

&lt;?php $data = array(
              'name'        => 'UserName',
              'id'          => 'username',
              'value'       => '',
              'maxlength'   => '20',
              'size'        => '20',
              'style'       => 'width:50%',
            );
?&gt;

&lt;?php echo form_input($data); ?&gt;

&lt;!-- ********************************************************************************************************* --&gt;

</br>
<h5>Mot de passe</h5>

&lt;?php $data = array(
              'name'        => 'password',
              'id'          => 'password',
              'value'       => '',
              'maxlength'   => '20',
              'size'        => '20',
              'style'       => 'width:50%',
            );
?&gt;

&lt;?php echo form_input($data); ?&gt;

&lt;!-- ********************************************************************************************************* --&gt;

</br>
</br>

<div>&lt;input type="submit" value="Login" /&gt;&lt;/div>

&lt;/form&gt;

&lt;/body&gt;
&lt;/html&gt;
#2

[eluser]LuckyFella73[/eluser]
You have a typo here:
Code:
$this->form_vaidation->set_rules('username','username','required');
$this->form_vaidation->set_rules('password','password','required');


// $this->form_vaidation -> $this->form_va(l)idation
#3

[eluser]Unknown[/eluser]
i'am an idiot !!!!!!!!!!!!!

Thanks very much.
#4

[eluser]LuckyFella73[/eluser]
No you are not! That is what happens all of us some time.




Theme © iAndrew 2016 - Forum software by © MyBB