3

After i used form submit my controller make this operation (pseudocode):

form_open('wpis/dodaj','name="form"')
->
wpis (controller)
->
dodaj()
->
[operation with model]
$this -> load -> view('layouts/main')

Works fine but address bar is still www.mysite.com/wpis/dodaj. When i'm using

$this -> load -> view('layouts/main')
redirect() or redirect('mvc')

i get

headers already sent error

How can i run controller mvc in dodaj function, in wpis controller? MVC is my default controller.

Bejkrools
  • 1,129
  • 2
  • 17
  • 38

1 Answers1

1

You don't want to load the view. Only redirect to 'mvc'. Then in 'mvc' controller you have the code to handle this redirection, and load the view.

Greg Kelesidis
  • 1,069
  • 14
  • 20
  • you're right, because then i use redirect before i send header in main view. Im mvc controller i load this same main view too... – Bejkrools Mar 23 '15 at 14:58