Example #1
0
                <select class="form-control" name="account_type" id="sel1">
                  <option>Account Type:</option>
                  <option>Teacher</option>
                  <option>Student</option>
                </select>
              </div>

              <button type="submit" name="submit" class="btn btn-default">Submit</button>

                <!-- PHP code to store login information into database. -->
                <?php 
// Create a database link.
require 'Session/config.php';
session_start();
$config = new Config();
$db = $config->GetDatabaseLink();
// Check for a post from the registration form
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    // Obtain information from the user
    $firstName = mysqli_real_escape_string($db, $_POST['firstname']);
    $lastName = mysqli_real_escape_string($db, $_POST['lastname']);
    $email = mysqli_real_escape_string($db, $_POST['email']);
    $password = mysqli_real_escape_string($db, $_POST['password']);
    $passwordConfirm = mysqli_real_escape_string($db, $_POST['password_confirm']);
    $accountType = '';
    if (isset($_POST['submit'])) {
        $accountType = $_POST['account_type'];
        echo "Selected account type: " . $accountType;
    } else {
        echo "no account selected";
    }