So I haven't the foggiest idea on what needs to be done to get this dropdown menu working. It was working before, but when I made some modifications, it wasn't working anymore. The error message displayed is:
Notice:  Undefined variable: categories in D:\xampp\htdocs\tech_support\product_register\product_register.php on line 19
But I have it defined in my index.php:
<?php
    require('../model/database.php');
    // Get the models needed - work will need to be done in both
    require('../model/customer_db.php');
    require('../model/product_db.php');
    require('../model/registration_db.php');
    $action = filter_input(INPUT_POST, 'action');
    if ($action == NULL) {
        $action = filter_input(INPUT_POST, 'action');
        if ($action == null) {
            $action = 'product_register';
        }
    }
    //When the user clicks the first link on the home page, bring them to the login page.
    if ($action == 'product_register') {
        include('customer_login.php');
    }
    //When the user clicks the login button, the system checks for errors in their typing.
    //If no errors are present, proceed to product_register.php.
    else if ($action == 'login') {
        $email = filter_input(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL);
        if ($email == NULL || $email == FALSE) {
            $error = 'Invalid email. Try again.';
            include('../errors/error.php');
        } else {
            $custEmail = get_email($_POST['email']);
            if ($custEmail) {
                $category_name =  get_product_name($productName);
                $categories = get_products();
                $products = get_products_by_name($name);
                header("Location: product_register.php");
            } else {
                $error = 'Invalid email. Try again.';
                include('../errors/error.php');
            }
        }
    }
?>
and I have it defined in my functions
<?php
// Get all the products for the registration dropdown list
function get_products() {
    global $db;
    $query = 'SELECT * FROM products
              ORDER BY productCode';
    $statement = $db->prepare($query);
    $statement->execute();
    return $statement;    
}
function get_product_name($productName) {
    global $db;
    $query = 'SELECT * FROM products
              WHERE productCode = :product_code';    
    $statement = $db->prepare($query);
    $statement->bindValue(':product_name', $productName);
    $statement->execute();    
    $product = $statement->fetch();
    $statement->closeCursor();    
    $product_name = $product['name'];
    return $product_name;
}
function get_products_by_name($name) {
    global $db;
    $query = 'SELECT * FROM products
              WHERE products.name = :name
              ORDER BY productCode';
    $statement = $db->prepare($query);
    $statement->bindValue(":name", $name);
    $statement->execute();
    $products = $statement->fetchAll();
    $statement->closeCursor();
    return $products;
}
product_register.php
<?php include '../view/header.php'; ?>
<?php require('../model/database.php'); ?>
<main>
    <h2>Register Product</h2>
    <?php if (isset($message)) : ?>
        <p><?php echo $message; ?></p>
        <?php
    else:
        $email = filter_input(INPUT_POST, 'email');
        ?>
    <?php endif; ?>
         <form action="index.php" method="post">
    <label>Customer:</label><br>
<?php echo $email; ?>
    <label>Product:</label>
    <select>
        <?php foreach ( $categories as $category ) : ?>
            <option value="<?php echo $cateogry['productCode']; ?>">
                <?php echo $category['name']; ?>
            </option>
        <?php endforeach; ?>
        </select><br>
        <input type="hidden" name="action" value="register_product">
        <input type="submit" value="Register Product">
    </form>
</main>
<?php include '../view/footer.php'; ?>
What am I doing wrong?
 
     
     
     
    