problem with quickform catching all POSTs

From: Date: Mon, 02 May 2005 16:23:05 +0000
Subject: problem with quickform catching all POSTs
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-19039@lists.php.net to get a copy of this message
I have a quickform for a login form that I am using with smarty. I also have a custom form that appears on a page along with the login quickform. What I do on my forms is test the POST to see either what the submit button value is or for a specific field to see which form has been posted. The quickform form always gets called though and it's messing with the page load. The problem seems to be I have a page redirect if the form validates, but it is redirecting every time I submit the other form which it seems it shouldn't do because there is no valid login submitted. Can anyone enlighten me to what is going on and how I might correct it? Below is the code to the login form that is a function in a class extending quickform. If I comment out the call to this function the other form works just fine. Thanks Rick Function creating the form: function show_login_form($smarty) { //$smarty->debugging = true; if( isset( $_SESSION['UN'] ) ) { // marked that they are logged in $smarty->assign( 'login', true ); $smarty->assign( 'Session', $_SESSION ); } else { // add the elements to the form $this->addElement( 'header', 'login_header', 'Login' ); $fields[] = &HTML_QuickForm::createElement( 'text', 'username', 'Username', array('size' => 15, 'maxlength' => 25 ) ); $fields[] = &HTML_QuickForm::createElement( 'password', 'password', 'Password', array('size' => 15, 'maxlength' => 25 )); $this->addGroup($fields, 'fields', '<br />'); $this->addElement( 'submit', 'login_button', 'Login' ); $this->registerRule('login_user', 'callback', 'login_user', 'login'); $this->addRule('fields', 'Invalid Username/Password!', 'login_user'); // set the renderer options $renderer = &new HTML_QuickForm_Renderer_ArraySmarty( $smarty ); $renderer->setErrorTemplate( '{$html} {if $error} <span class="error">{$error}</span> {/if}' ); if( $this->validate() ) { // marked that they are logged in header('Location: index.php' ); exit; }// end if form validated else { $smarty->assign( 'login', false ); $this->accept( $renderer ); $smarty->assign( 'form_data', $renderer->toArray() ); //$smarty->display( 'login_form.tpl' ); }// end if form did not validate }// end else the person is not logged in }// end function show_login_form

« previous php.pear.general (#19039) next »