Re: headers already sent
| From: | Mark Steudel | Date: | Fri, 12 Mar 2010 07:04:10 +0000 |
| Subject: | Re: headers already sent | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-30401@lists.php.net to get a copy of this message | ||
Show us your code in login_form_test.php and probably default renderer.
Can you comment all there lib/*php files and see if the problem goes away?
Make sure you don't have any extra spaces at the top of your pages.
Something like this works just fine:
$form = new HTML_QuickForm( 'newForm' );
$form->addElement( 'text', 'varname', 'Lable:' );
if( $form->validate() ) {
header( "location: someotherfile.php");
exit;
}
else {
$form->display();
}
On Fri, Mar 12, 2010 at 12:56 AM, Andrea Bakker <abakker@telkomsa.net> wrote:
> I've googled this topic quite a bit and I don't think I understand the way quickform
> works. The following code gives the headers already sent error. My login_test_form is just a
> simple quickform with 2 username & Password. Does the $loginform->validate() send
> header info ? If so how can I ever redirect without getting the "headers already sent"
> error ?
>
> <?php
> $pagename = 'login';
> include('config.php');
> include(DIR_APPLICATION . '/lib/user.lib.php');
> include(DIR_APPLICATION . '/lib/advert.lib.php');
> include(DIR_APPLICATION . '/lib/defaultformrenderer.lib.php');
> include('functions.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">
> <?php include('inc/header.php');
> include('inc/topmenu.php');
> include('inc/logmenu.php');
>
> ?>
> <div id="wrapper" class="clearfix">
> <div id="maincontentuser">
> <?php
> $renderer = new DefaultFormRenderer($loginform);
> include('inc/head.php');
> $renderer->display();
> ?>
> </div>
>
> </div> <!-- end wrapper div -->
> <?php include('inc/footer.php'); ?>
> </div> <!-- end maincontainer div -->
> </body>
> </html>
>
--
-----------------------------------------
Mark Steudel
P: 206.375.7244
msteudel@gmail.com
. : Work : .
http://www.mindfulinteractive.com
. : Play : .
http://www.steudel.org/blog