Forum Moderators: coopster
I have one user table in my MySQL database and this is linked to a user type table containing 3 types of user. Each type of user will be required to give a different amount of data when registering.
Basically I want to create one registration form for all types of users but only show the form fields that are relevant to the individual user type. The user type will be selected from a pervious page containing a list menu with the 3 user types that is sent via GET to the registration page.
I am guessing that I will have to use if startments but amnot sure how to do it.
Any help would be great!
Thanks
if($_GET["user_type"] == 1){
print "form field here";
}
Alternatively, create three separate forms(just the form) and save them as .txt, .html or .php(if they will contain php code). On the main form page, right at the point where the form code should start, run a switch statement and include the proper form.
<html><body>
<?php
switch($_GET["user_type"]){
case 1: include($_SERVER["DOCUMENT_ROOT"]."path/to/form1.txt);
break;
case 2: include($_SERVER["DOCUMENT_ROOT"]."path/to/form2.txt);
break;
case 3: include($_SERVER["DOCUMENT_ROOT"]."path/to/form3.txt);
break;
default: header("Location: /pickusertype.php"); //no user type chosen(redirect)
}
?>