Welcome Guest, Not a member yet? Register   Sign In
set_value not working?
#4

[eluser]Henrique Luz[/eluser]
The error occurs because you're validating the data before sending them to the view for the controller.

Then the email field is always blank, and thus, the method form_validation->run always returns false.
Try something like that in your controller:
Code:
<?php
class Forgotten extends CI_Controller
{
  function Forgotten()
  {
      parent::__construct();
      $this->load->helper('form');
  }

  public function index(){
      $this->load->view('help/forgottensent_body');  
  }
  
  public function validate(){
        $this->load->library('form_validation');        
        $this->form_validation->set_rules('email', 'Email Address', 'required|valid_email');
          
      
        if($this->form_validation->run() == FALSE)
        {
            //ERROR
        }
        else{
          $this->load->view('forgottensent_body');
        }    
              
     }
}
?>

And your view:

Code:
<form action='validate' method='post'>
    Please enter your email. Your password will be sent to you.<br>
    Email Address:
    &lt;input type="text" name="email" value="" size="100" value=”&lt;?php echo set_value('email'); ?&gt;” /&gt;
    <div>
    &lt;input type="submit" value="Submit" /&gt;
    </div>
&lt;/form&gt;


Messages In This Thread
set_value not working? - by El Forum - 07-01-2011, 05:23 AM
set_value not working? - by El Forum - 07-01-2011, 07:18 AM
set_value not working? - by El Forum - 07-01-2011, 07:22 AM
set_value not working? - by El Forum - 07-01-2011, 07:40 AM
set_value not working? - by El Forum - 07-01-2011, 08:02 AM
set_value not working? - by El Forum - 07-01-2011, 08:09 AM
set_value not working? - by El Forum - 07-07-2011, 01:07 AM
set_value not working? - by El Forum - 07-07-2011, 01:35 AM
set_value not working? - by El Forum - 07-07-2011, 02:11 AM



Theme © iAndrew 2016 - Forum software by © MyBB