0

I was working on a script before taking ill. I need urgent help with this.

I have login form, and I can use http://phpeasystep.com login tutorial to do a single user login. But I need it for like 4 different users redirecting to diffrent pages after login/

The form code:

<form action="checklogin.php" method="POST" name="logForm">
  <fieldset>
  <legend>Please Login Here!</legend>
    <label for="name">Username:</label>
    <input type="text" name="username" id="username" />
    <br /> <br /> <br />
    <label for="password">Password:</label>
    <input type="password" name="password" id="password" />
    <br /> <br /> <br />
    <label for="address">User Type:</label>
    <select name="subtype" id="subtype">
        <option value="" selected="selected">Select Type..</option>
        <option value="1">User1</option>
        <option value="Nurse">User2</option>
        <option value="Accountant">User3</option>
        <option value="Lab Tech">User4</option>
    </select>
    <br /> <br /> <br />
    <label for="submit">&nbsp;</label>
    <input type="image" name="submit" src="images/login_button.png" />
  </fieldset>
</form>

I have a database with, username, password and subtype

Edited by Dani: Indented code

3
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by diafol
0

Ehh? I'm guessing you know the names of these users?

I would use sessions:

<?php

      // if sucsessfully signed in
      $_SESSION['username'] = $username;

      switch($_SESSION['username'])
      {
         case 'bob':
         // redirect for bob
         break;

         case 'harry':
         // redirect for harry
         break;

         default:
          // default redirect
      }
  ?>
2

I believe that we've advised you before about the wisdom of providing a dropdown in the login form. The form should redirect automatically on successful login since the DB stores the subtype so you can retrieve it and send them to the right page. SHould be simple.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.