Cannot modify header information

Good Day!

I’m trying to saving the contents of my form, I’m using CJuiDialog and CActiveForm at the same time. There’s is no problem in the form, the problem occurs when hitting the save button.

Here is the description of error returned by PHP:

Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\ADS\protected\controllers\CreditorDebtorController.php:73)

here is the stack trace:


     public function redirect($url,$terminate=true,$statusCode=302)

654     {

655         if(strpos($url,'/')===0)

656             $url=$this->getHostInfo().$url;

[color="#FF0000"]657         header('Location: '.$url, true, $statusCode);[/color]

658         if($terminate)

659             Yii::app()->end();

660     }



Stack Trace #2

C:\xampp\htdocs\ADS\protected\controllers\CreditorDebtorController.php(102): CController->redirect(array("view", "creditorId" => null))




097                                             //$this->redirect(array('view','id'=>$model->BOOK_UID)); // Redirect to another page.

098                                 exit;

099                             }

100                             else

101                             //print_r($_POST['CreditorDebtor']);    

[color="#FF0000"]102                             $this->redirect(array('view','creditorId'=>$model->creditorId));[/color]

103                         }

104                    

105                         //$this->renderPartial('_form',array('model'=>$model));

106                     }



Thank you very much guys…

:D :D :D :D

It would be important to have CreditorDebtorController.php:73 as stated in the error message. Most likely you have an echo, so PHP needs to send an earlier and thus cannot send another one later, or a command there doesn’t work, so PHP also sends a(n error) message.

After saving the record i’m trying to redirect the it to another page. Unfortunately I don’t have an idea why the creditorId = null. I already check my stored procedure oracle and its working.

Hi,

what do you have in 73rd line of this controller?

I had also got this error.

Cannot modify header information - headers already sent by (output started at /home1/fxgivesc/public_html/weinside/protected/controllers/SiteController.php:1)

I checked out all echo or print value in that file. I checked the spaces before and after the opening and closing of php tag i got nothing there.

I tried hard , i googled down the internet and reached there. This discussion helped

http://www.yiiframework.com/forum/index.php/topic/5554-redirect-problems/

What my error was duing upload may be some hex encoding problem.

I copied the content of file in text editor and saved it and i uploaded the same file to server it works like a magic.

nirmalroka - the person you are working for will never pay you.

Now I’m intrigued.

I recognised the server from the error message that was posted. The person who owns this website hires Yii developers, then does not pay them and locks them out of the server… then brings along the next bunch of devs to dupe.

The guy is a crook: Yosi Peri - Yosi Friedman

Ouch, that sucks.

Thanks for the heads up. I gather he’s black listed at the various freelance sites?

If not, he should be.

I’m not sure, however because he has had many devs of various talent work on the website, there are many security flaws. I can bring down the whole website at any time I please, or write to the file system or database, even without access to his cPanel or FTP :P