From: "Andrea Bakker" on
I've googled this topic quite a bit and I don't think I understand the way
quickform works. I have reduced my code to the minimum and am still getting headers already sent . My
login_test_form is just a simple quickform with a username & Password. I've taken out all rules. Does
the $loginform->validate() send header info ? If so how can I ever redirect
without getting the "headers already sent" error ?

Below is the main code.
logtest.php
$pagename = 'login';
include('config.php');
include(DIR_APPLICATION . '/lib/login_form_test.php');
if(isset($_POST['Login']))
{if ($loginform->validate()) {
// Form is validated, then processes the data
$url = HTTP_SERVER . "listing.php";
header("Location: $url");
exit;
}
}
?>
<body>
<div id="maincontainer">
<div id="wrapper" class="clearfix">
<div id="maincontentuser">
<?php
include('inc/head.php');
$loginform->display();
?>
</div>
</div> <!-- end wrapper div -->
</div> <!-- end maincontainer div -->
</body>
</html>

login_form_test.php
<?php
require_once 'HTML/QuickForm.php';
PEAR::setErrorHandling(PEAR_ERROR_DIE);
$loginform = new HTML_QuickForm('loginForm');
$loginform->addElement('header', null, 'Enter Your Details Below');
$loginform->addElement('text', 'username', 'User Name:', array('size' => 30, 'maxlength' => 30, 'class'=>"label"));
$loginform->addElement('password', 'password', 'Password :', array('size' => 32, 'maxlength' => 30));
$loginform->addElement('submit', 'Login', 'Login');
$loginform->addElement('link','fp_link','',
'forgotpassword.php', 'Forgot Password',
'_target="blank"');
$loginform->applyFilter('username', 'trim');
$loginform->addRule('username', 'Please enter your User Name', 'required');
$loginform->addRule('password', 'Please enter your Password', 'required');
?>

inc/head.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>JBay Kids site</title>
<meta name="description" content="For all your kids entertainment and activities in the Jeffreys Bay area." />
<meta name="keywords" content="" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="css/jbaykids.css" />
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="css/ie.css" />
<![endif]-->
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
</head>
From: Alexey Borzov on
Hi Andrea,

On 15.03.2010 13:38, Andrea Bakker wrote:
> I've googled this topic quite a bit and I don't think I understand the way
> quickform works. I have reduced my code to the minimum and am still getting headers already sent . My
> login_test_form is just a simple quickform with a username& Password. I've taken out all rules. Does
> the $loginform->validate() send header info ? If so how can I ever redirect
> without getting the "headers already sent" error ?

You are not quoting the whole error message. PHP usually adds "output started
on..." to that.
From: Alexey Borzov on
Hi Andrea,

On 15.03.2010 14:10, Andrea Bakker wrote:
> Sorry, the line 15 it is referring to is the closing ?> tag which is the
> last line of code in the login_form_test
>
> Warning: Cannot modify header information - headers already sent by
> (output started at
> /home/jbaykids/public_html/lib/login_form_test.php:15) in
> /home/jbaykids/public_html/logtest.php on line 10

1) Please reply to the list,
2) You probably have some whitespace in that file after the closing tag. Either
remove that whitespace or remove the closing tag altogether.


> ----- Original Message ----- From: "Alexey Borzov" <borz_off(a)cs.msu.su>
> To: "Andrea Bakker" <abakker(a)telkomsa.net>
> Cc: "pear general" <pear-general(a)lists.php.net>
> Sent: Monday, March 15, 2010 8:53 AM
> Subject: Re: [PEAR] headers already sent on login with quickform
>
>
>> Hi Andrea,
>>
>> On 15.03.2010 13:38, Andrea Bakker wrote:
>>> I've googled this topic quite a bit and I don't think I understand
>>> the way
>>> quickform works. I have reduced my code to the minimum and am still
>>> getting headers already sent . My
>>> login_test_form is just a simple quickform with a username& Password.
>>> I've taken out all rules. Does
>>> the $loginform->validate() send header info ? If so how can I ever
>>> redirect
>>> without getting the "headers already sent" error ?
>>
>> You are not quoting the whole error message. PHP usually adds "output
>> started on..." to that.
>>
>

From: "Andrea Bakker" on
Thanks to everyone who has looked at this. I thought it was a quickform
thing as I was convinced I had taken out all the white space, but it turns
out there was a space at the end of the closing tag !!

Thanks again for your great support
Andrea

----- Original Message -----
From: "Alexey Borzov" <borz_off(a)cs.msu.su>
To: "Andrea Bakker" <abakker(a)telkomsa.net>; "pear-general"
<pear-general(a)lists.php.net>
Sent: Monday, March 15, 2010 9:12 AM
Subject: Re: [PEAR] headers already sent on login with quickform


> Hi Andrea,
>
> On 15.03.2010 14:10, Andrea Bakker wrote:
>> Sorry, the line 15 it is referring to is the closing ?> tag which is the
>> last line of code in the login_form_test
>>
>> Warning: Cannot modify header information - headers already sent by
>> (output started at
>> /home/jbaykids/public_html/lib/login_form_test.php:15) in
>> /home/jbaykids/public_html/logtest.php on line 10
>
> 1) Please reply to the list,
> 2) You probably have some whitespace in that file after the closing tag.
> Either remove that whitespace or remove the closing tag altogether.
>
>
>> ----- Original Message ----- From: "Alexey Borzov" <borz_off(a)cs.msu.su>
>> To: "Andrea Bakker" <abakker(a)telkomsa.net>
>> Cc: "pear general" <pear-general(a)lists.php.net>
>> Sent: Monday, March 15, 2010 8:53 AM
>> Subject: Re: [PEAR] headers already sent on login with quickform
>>
>>
>>> Hi Andrea,
>>>
>>> On 15.03.2010 13:38, Andrea Bakker wrote:
>>>> I've googled this topic quite a bit and I don't think I understand
>>>> the way
>>>> quickform works. I have reduced my code to the minimum and am still
>>>> getting headers already sent . My
>>>> login_test_form is just a simple quickform with a username& Password.
>>>> I've taken out all rules. Does
>>>> the $loginform->validate() send header info ? If so how can I ever
>>>> redirect
>>>> without getting the "headers already sent" error ?
>>>
>>> You are not quoting the whole error message. PHP usually adds "output
>>> started on..." to that.
>>>
>>
>