Jump to content

Multiple login forms on one html page for different databases


possien

Recommended Posts

I am building a tabbed page that within each tab (division) i have a login form.  Each tab(division) is to log in to a different database.  How do i connect the user to that database and send them to their admin page? I.e. there are 4 login forms on a page. I want to send them to their admin page when they login on that form.

Either you set different form actions on each form, or use a common page to send the user depending on where you want them to go, example

<?php

// login_router.php

session_start();

if(isset($_POST['submit'])){

$_SESSION['area'] = $_POST['destination'];

switch ($_POST['destination']){

  case 'area1':
  header('Location: http://www.example.com/area1.php');
  break;
  
  case 'area2':
  header('Location: http://www.example.com/area2.php');
  break;
  
  default:
  header('Location: http://www.example.com/area.php');
  
}

}

?>

 

<!-- One of the tabbed pages form -->

<form action="login_router.php">

<input type="hidden" name="destination" value="area1" />

<!-- or use a select drop down or whatever -->

<input type="submit" name="submit" value="Log in" />

</form>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.