kohana - How do I pass parameters after setting the content of a template? -


my problem lose parameters (i.e. can't use id variable) when inside if condition because occurs after press submit button in view (i.e. after set post array)

public function action_resetpassword() {     $this->template->content = view::factory('user/password/reset')     ->bind('message', $message)     ->bind('errors', $errors);      if (http_request::post == $this->request->method())      {                    $id = $this->request->param('id'); 

if understand correctly wish pass parameters view set in if. can done 'binding' these variables view (i.e. pass reference)

public function action_resetpassword() {     $this->template->content = view::factory('user/password/reset')         ->bind('message', $message)         ->bind('errors', $errors)         ->bind('id', $id); // empty variable defined here ...      if (http_request::post == $this->request->method())      {         // ... , set here         $id = $this->request->param('id'); 

inside view $id have value of whatever comes request parameter.

if not mean, should read bit variable scope in php , question not related kohana

http://php.net/manual/en/language.variables.scope.php


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -