Registration & Login Form

Hi,

I need to create a register form and a login form for my users of the system.

I have identified the tables in MySQL database.

There are two different types of my users in my system.

The first type of user has access to all parts of the system (can add member, edit member, etc)
The second type of user are users of the system but they can only raise a request within the system (cannot add/edit members).

For my registration form, I am thinking to have the users log in via their email address as that will definitely be unique and of course, a password.

How do I create the registration form so that I can have two different types of users within my system at sign up?

I want to have a drop down box which says something like…

Select user type:

then have the options drop down like “user type 1”, “user type 2”, “user type 3”

Currently in my MySQL database, I have 2 tables, one for the first user group and the second for the second user group. How do I link it up so that when new users register, I am able to have their details in one place/table listing their member_id, followed by email address and password fields (I am planning to use md5 plus salt).

Also, the details I need for user group 1 and user group 2 are different (don’t require some fields needed in the other such as gender for example).

Thank you.

You could query the database looking for the user types available.

This would return user type data in an array of objects that could then be used to populate a select dropdown.


<?php
    $stmt = $pdo->prepare("SELECT user_type_id, user_type_title FROM user_types");
    $usertypes = $stmt->fetchAll(PDO::FETCH_OBJ);
?>
<select>
<?php foreach($usertypes as $type) {
     echo "<option value='{$type->user_type_id}'>{$type->user_type_title}</option>";
}
?>
</select>

You would need to change this to match the format of the data that is returned from the database but it should give you a general idea of one way you could accomplish this.

Thank you very much, Jeremy.

Do you think this method would also work?

To have 2 sign up pages, one for my user type 1 and the other for my user type 2 (which will also have 3 sub-categories [drop down list options] for the user type 2)?

You can do it a thousand different ways, which ever is better for you and those who will use the system. If you find it better for now to have two different forms than you can do that and maybe go back and switch it around when you are more comfortable with php.

Thank you for your help. Much appreciated!