Login Retreive lost passwordRegister
Search

Forum Index / General / Redirect in function doRun()

[ This topic is solved ]

  Tom Novotny 21 April 09 / 22:19  
Hi, I'm impressed about this class, great work. Nevertheless, I need some help.

After submitting some user data on a login page, I want to save them in a session and redirect to another page. But, if I add "header ('Location: my_page.php');" into my "doRun"-Function, there is no redirection.

Thanks for any hint.

Chees, Tom.

  Johan Wiegel (Admin) 22 April 09 / 16:11  
can you show us some code?

it's normaly working for us...

<?php
function FH_SAVE$id$aData )
{
  
// do sometyhing
  
........
  
// go to google
  
header'location:http://www.google.com' );
  exit;
}

$oForm = new dbFormhandler();
........
$oForm->Flush();
?>

  Tom Novotny 22 April 09 / 21:49  
Here some code...

After submitting, I want eo check the userdata and then redirect to another page.
Well I get into the doRun function, I can echo anything, but redirect doesnt work.

Is there any example source for a user login with formhandler?

Thanks.

Tom.

<?php
//snip
function doRun($data, &$form ){
        
        if(
validateUser($data['username'],$data['password']))
          
header("Location: ./intern/index.php");
        else
          
header("Location: http://www.google.com" );
          
               exit(); 
}
<
div style="float:left">
    <?
php
            
// create a new FormHandler object
            
$form =& new FormHandler();
            
            
// some fields.. (see manual for examples)
            
$form->textField"Username""username"FH_ALPHA_NUM2040);
            
$form->passField"Password""password"FH_PASSWORD2040);
            
// button for submitting
            
$form->submitButton("Login""save");    
            
            
// set the onCorrect function
            
$form->onCorrect("validateUserData");
            
            
// flush
            
$form->flush();    
     
?>

</div>
//snip

  Johan Wiegel (Admin) 23 April 09 / 07:27  
the oncorrect calls a function validate user which doesn't exist?

  Top


powered by PHP-GLOBE   © 2004 - 2012 FormHandler. All rights reserved.   -   Open source license