 |
|
|
| View previous topic :: View next topic |
| Author |
Message |
IRG
Joined: 10 Jun 2009 Posts: 10 Location: london
|
Posted: Mon Jun 15, 2009 5:41 pm Post subject: qfc and xhtml document |
|
|
Hi all,
I have a wizard which works fine on its own. However, when I put it into an xhtml document I get Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\DTRsurvey\test.php:9) in C:\xampp\php\PEAR\HTML\QuickForm\Action\Jump.php on line 158 when I try to move to page 2 of the wizard. I cannot put the form in the beginning of the page as I have to have a header in the beginning of the page. What should I do in order for qfc to process my page?
This is my test page.
| Code: | <?php session_start();?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Test page</title>
</head>
<body>
<?php
require_once 'HTML/QuickForm/Controller.php';
require_once 'HTML/QuickForm/Action/Next.php';
require_once 'HTML/QuickForm/Action/Back.php';
require_once 'HTML/QuickForm/Action/Jump.php';
require_once 'HTML/QuickForm/Action/Display.php';
class NewPageTest extends HTML_QuickForm_Page
{
private $surveyID;
private $sectionID;
private $sectionTitle;
function __construct($formName, $surveyID, $sectionID, $sectionTitle,$method = 'post', $target = '', $attributes = null)
{
parent::__construct($formName,$method = 'post', $target = '', $attributes = null);
$this->surveyID = $surveyID;
$this->sectionID = $sectionID;
$this->sectionTitle = $sectionTitle;
}
function buildForm()
{
$this->_formBuilt = true;
//create form
$this->addElement('header',null,$this->sectionTitle);
$this->addElement('text','name','Enter name:',array('size' => 30));
if($this->sectionID == 1) {
$this->addElement('submit', $this->getButtonName('next'), 'Next >>');}
if($this->sectionID == 2) {
$prevnext[] = & $this->createElement('submit', $this->getButtonName('back'), 'Back <<');
$prevnext[] = & $this->createElement('submit', $this->getButtonName('next'), 'Next >>');
$this->addGroup($prevnext,null,'',' ',false);
}
$this->setDefaultAction('next');
}
}
class ActionProcess extends HTML_QuickForm_Action {
function perform(&$page, $actionName)
{
}
}
$quest =& new HTML_QuickForm_Controller('Questionnaire');
$quest->addPage(new NewPageTest('Page1',1,1,'Test Page 1'));
$quest->addPage(new NewPageTest('Page2',1,2,'Test Page 2'));
$quest->addAction('next', new HTML_QuickForm_Action_Display());
$quest->addAction('next', new HTML_QuickForm_Action_Next());
$quest->addAction('back', new HTML_QuickForm_Action_Back());
$quest->addAction('jump', new HTML_QuickForm_Action_Jump());
#process form
$quest->addAction('process', new ActionProcess());
$quest->run();
?>
</body>
</html>
|
Please help. |
|
| Back to top |
|
 |
mark

Joined: 07 Jan 2007 Posts: 1230
|
Posted: Mon Jun 15, 2009 11:20 pm Post subject: |
|
|
Well, the error message is quite descriptive, isn't it?
Is line 9 the session_start() call? If yes, call this function as early as possible and you're done. There's a hack that would allow to leave this call there, but moving the call is much cleaner IMHO. |
|
| Back to top |
|
 |
IRG
Joined: 10 Jun 2009 Posts: 10 Location: london
|
Posted: Thu Jun 18, 2009 5:14 pm Post subject: |
|
|
Hi Mark,
Thank you for your answer. is on the first line and not on the line #9. I managed to solve this probllem by adding
after . |
|
| Back to top |
|
 |
mark

Joined: 07 Jan 2007 Posts: 1230
|
Posted: Thu Jun 18, 2009 6:23 pm Post subject: |
|
|
ob_start() is the mentioned dirty solution.
If you tell us more about line 9, you might get a cleaner solution here. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|