JFC.
I had a space after the ?> in the model file as well as the
controller. I removed it and now it's fixed.
I love you brian.

-Armen




On Aug 10, 7:22 am, brian <[email protected]> wrote:
> A redirect() causes PHP to send headers to the client, informing it of
> a redirect. The client then sends a new request. The "headers already
> sent" msg happens when PHP has already started output. You'll have to
> look in your files for any whitespace outside of the <?php & ?> or an
> echo call or something similar. Start in users_controller.php and also
> check the view.
>
> On Mon, Aug 10, 2009 at 6:38 AM, armen<[email protected]> wrote:
>
> > When i remove the redirect code from the controller, the page doesn't
> > redirect and table insertion is done correctly. but This is the
> > message that I get when i try using redirect in the controller.
>
> > ------------------------------------------------------------------------------------------------------------------
> > Warning (2): Cannot modify header information - headers already sent
> > by (output started at C:\xampp\htdocs\bleed_till_death\UserLoging\app
> > \controllers\users_controller.php:32) [CORE\cake\libs\controller
> > \controller.php, line 640]
>
> > Code | Context
>
> > $status =       
> > "Location:http://localhost/bleed_till_death/UserLoging/index";
>
> > header - [internal], line ??
> > Controller::header() - CORE\cake\libs\controller\controller.php, line
> > 640
> > Controller::redirect() - CORE\cake\libs\controller\controller.php,
> > line 621
> > UsersController::add() - APP\controllers\users_controller.php, line 18
> > Object::dispatchMethod() - CORE\cake\libs\object.php, line 115
> > Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 227
> > Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 194
> > [main] - APP\webroot\index.php, line 88
> > ------------------------------------------------------------------------------------------------------------------
>
> > And this is the controller file.
>
> > ------------------------------------------------------------------------------------------------------------------
> > <?
> > class UsersController extends AppController {
> >    var $name = 'Users';
> >    var $helpers = array('Html', 'Form');
> >                var $scaffold;
>
> >                function index()        {
> >                                $this->set('users',$this->User->find('all'));
> >                }
>
> >                function add()          {
>
> >                  if (!empty($this->data))              {
>
> >                    $this->User->create();
> >                          if ($this->User->save($this->data)) {
> >                                   $this->Session->setFlash(__('The Post has 
> > been saved', true));
> >                                         $this->redirect('/index');
> >                                         // I even tried  $this-
> >>redirect(array('controller' => 'index')); and instead of controller i
> > tried action as well.
>
> >                          }
> >                          else {
> >                                   $this->Session->setFlash(__('The Post 
> > could not be saved.
> > Please, try again.', true));
> >                          }
> >                  }
>
> >                        $this->set('users',$this->User->find('all'));
> >          }
> > }
>
> > ?>
> > ------------------------------------------------------------------------------------------------------------------
>
> > What could i be doing wrong?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to