Call a controller function from view |
[eluser]jrad[/eluser]
Need a little help on this. I've got a view that displays a login form and two tables which data are fetched from db. I've been testing form_validation and whenever I try to submit an empty form and get a validation error (which I expect) I also run into problems with the two tables. Because it throws an error everytime the page reloads after an error in the login form is found. here's the code Code: <?php Is there a way to call a controller function from within a view file so everytime a view file is reload (for whatever reason) the table will also be reloaded? Any suggestion or idea will be most appreciated. PHP error: undefined variable: mydata
[eluser]dcunited08[/eluser]
Take a look at Wick or Modular_Extensions_-_HMVC. You may also be able to pass an instance of the object to the view using: Code: $this->load->vars(array('obj' => $this)); Code: $obj->controller_function($data);
[eluser]Pascal Kriete[/eluser]
This sounds like a very straightforward situation, so I would assume that there's a logic error in the controller somewhere. The same data should be available regardless of the form's status.
[eluser]JoostV[/eluser]
From the look of it, your view complains that $mydata is not set. Try checking if $mydata is set, instead of checking whether $mydata is an empty string. Code: if(!isset($mydata)){ |
Welcome Guest, Not a member yet? Register Sign In |