21311 Posts in 5739 Topics by 2604 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 792 Views |
-
Strange Redirect Message appearing!

7 May 2011 at 5:18am
Hi,
I've got a message appearing when I enter a search term and redirect to another page:
Redirecting to http://localhost/xxx/ie/home/roi-domestic-help-centre/new-faqsearchpage... (output started on C:\xampp\htdocs\xxx\FAQ\code\Tips.php, line 1)
I do a redirect from the page like this after taking in some form data for Search:
<code>
function doSearchResults($data, $form) {
$url = SEARCHURL;
Session::set('q', $data['q']);
Director::redirect($url);
}
</code>Tips looks like this
<code>
<?php
class Tips extends Page {
public static $db = array(
"Options" => "Enum('ie, uk')"
);function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab(
"Root.Content.Main",
new DropdownField(
'Options',
'Choose which country this tip applies to:',
singleton($this->class)->dbObject('Options')->enumValues())
);return $fields;
}
}
class Tips_Controller extends Page_Controller {/**
* An array of actions that can be accessed via a request. Each array element should be an action name, and the
* permissions or conditions required to allow the user to access it.
*
* <code>
* array (
* 'action', // anyone can access this action
* 'action' => true, // same as above
* 'action' => 'ADMIN', // you must have ADMIN permissions to access this action
* 'action' => '->checkAction' // you can only access this action if $this->checkAction() returns true
* );
* </code>
*
* @var array
*/
public static $allowed_actions = array (
);}
?>
</code>Thanks in advance,
Nick
-
Re: Strange Redirect Message appearing!

7 May 2011 at 2:47pm
Normally this occurs if you have whitespace after the ?> tag or before the <?php tag in one of your PHP files. This causes whitespace output so when submitting forms or other things which redirect will cause the warning you mention. This is why one of our guidelines is to avoid using the closing PHP tag.
-
Re: Strange Redirect Message appearing!

7 May 2011 at 10:49pm
Hi Willr,
Thanks once again for your help!
That's worked eventually... I couldn't find the rogue space or special character but when I re-wrote the php piece by piece it worked fine.
Cheers,
Nick
| 792 Views | ||
|
Page:
1
|
Go to Top |


