title: How to get my login and register functions to work correctly
body: <p>I have started the coding so then when a customer is registering a product on the first page (customer_login.php) they type in their email. When they press the login button, it takes them to the product_register.php page where it will display their full name. Then there is a drop down that will allow them to choose the product they are registering. Once completed and they hit the register product button, it is to show on the same page &quot;Product (name of the product chosen) has been registered successfully. I have shown the coding for all the pages below and I am just solely using PHP. It is suppose to work where when the button is pressed, it goes to the index.php and gets the name of the action and then produces what is required.</p>
  <p>customer_login.php</p>
  <pre><code>&lt;?php include '../view/header.php'; ?&gt;
  &lt;main&gt;
  
      &lt;h2&gt;Customer Login&lt;/h2&gt;
      &lt;p&gt;You must login before you can register a product.&lt;/p&gt;
      
      &lt;form action=&quot;index.php&quot; method=&quot;post&quot;&gt;
          &lt;p&gt;Email:
          &lt;input type=&quot;text&quot; action=&quot;login_customer&quot; class=&quot;search&quot;&gt;
          &lt;input type=&quot;submit&quot; value=&quot;Login&quot;&gt;&lt;/p&gt;
  
      &lt;/form&gt;
  
  &lt;/main&gt;
  &lt;?php include '../view/footer.php'; ?&gt;
  </code></pre>
  <p>product_register.php</p>
  <pre><code>&lt;?php include '../view/header.php'; ?&gt;
  &lt;main&gt;
  
      &lt;h2&gt;Register Product&lt;/h2&gt;
      &lt;?php if (isset($message)) : ?&gt;
          &lt;p&gt;&lt;?php echo $first_name;?&gt; &lt;/p&gt;
      &lt;?php else: ?&gt;
          &lt;?php foreach ($customers as $customer) : ?&gt;
              &lt;form action=&quot;index.php&quot; method=&quot;post&quot; id=&quot;aligned&quot; name=&quot;get_customer&quot;&gt;
              &lt;label&gt;Customer:&lt;/label&gt;
              &lt;input type=&quot;hidden&quot; name=&quot;name&quot;
                  value=&quot;&lt;?php echo htmlspecialchars($customer['first_name', 'last_name']); ?&gt;&quot;&gt;&lt;br&gt;
              &lt;label&gt;Product:&lt;/label&gt;
              &lt;select name=&quot;get_customer&quot;&gt;
                  &lt;option value=&quot;Draft Manager 1.0&quot;&gt;Draft Manager 1.0&lt;/option&gt;
                  &lt;option value=&quot;Draft Manager 2.0&quot;&gt;Draft Manager 2.0&lt;/option&gt;
                  &lt;option value=&quot;League Scheduler 1.0&quot;&gt;League Scheduler 1.0&lt;/option&gt;
                  &lt;option value=&quot;League Scheduler Deluxe 1.0&quot;&gt;League Scheduler Deluxe 1.0&lt;/option&gt;
                  &lt;option value=&quot;Team Manager Version 1.0&quot;&gt;Team Manager Version 1.0&lt;/option&gt;
                  &lt;option value=&quot;Tournament Master Version 1.0&quot;&gt;Tournament Master Version 1.0&lt;/option&gt;
                  &lt;option value=&quot;Tournament Master Version 2.0&quot;&gt;Tournament Master Version 2.0&lt;/option&gt;
              &lt;/select&gt;&lt;br&gt;&lt;br&gt;
          
              &lt;label&gt;&amp;nbsp;&lt;/label&gt;
              &lt;input type=&quot;submit&quot; action=&quot;register_product&quot; value=&quot;Add Product&quot; /&gt;&lt;br&gt;
              &lt;/form&gt;
          &lt;?php endforeach; ?&gt;    
          
      &lt;?php endif; ?&gt;
  &lt;/main&gt;
  &lt;?php include '../view/footer.php'; ?&gt;
  </code></pre>
  <p>index.php</p>
  <pre><code>&lt;?php
  require('../model/database.php');
  require('../model/customer_db.php');
  require('../model/product_db.php');
  require('../model/registration_db.php');
  ini_set('display_errors', '1');
  ini_set('display_startup_errors', '1');
  error_reporting(E_ALL);
  
  $action = filter_input(INPUT_POST, 'action');
  if ($action === NULL) {
      $action = filter_input(INPUT_GET, 'action');
      if ($action === NULL) {
          $action = 'get_customer';
      }
  }
  
  //instantiate variable(s)
  $email = '';
  
  if ($action == 'login_customer') {
      
      $email = filter_input(INPUT_POST, 'email');
  
      if ($email != false) {
          login_customer($email);
      }
  
      $customers = get_customers();
  
      include('product_register.php');
  
  } else if ($action == 'get_customer') {
      $get_customer = filter_input(INPUT_POST, 'get_customer');
      return $registration;
      include(&quot;customer_login.php&quot;)
  
  } else if ($action == 'register_product') {
      $customer = filter_input(INPUT_POST, 'customer');
      $get_customer = filter_input(INPUT_POST, 'get_customer');
  
      include(&quot;customer_login.php&quot;)
  }
  ?&gt;
  </code></pre>
  <p>What can I do to get this all to work correctly?</p>