$item->makeCustomer($firstname, $middlename, $lastname, $email, $address, $country, $phone, $my_file);
                $row1 = $item->getCustomerDetails($email);
                $ss1 = $row1->fetch_array(MYSQLI_ASSOC);
                $cid = $ss1['cust_id'];
                $item->makeOrder($cid, $date);
                $mail->sendAlertMail($firstname, $lastname, $email);
                header('Location: orders.php');
            } elseif (!is_null($cust_em['email']) && strcmp($cust_em['email'], $email) === 0) {
                $my_file1 = "./customer_history/" . "{$email}" . ".txt";
                foreach ($_SESSION['cart'] as $skirt_id => $details) {
                    $id = $_SESSION['cart'][$skirt_id]['item'];
                    $cart_qty = $_SESSION['cart'][$skirt_id]['quantity'];
                    $item = new Item();
                    $row = $item->getSkirtDetails($id);
                    $ss = $row->fetch_array(MYSQLI_ASSOC);
                    $new_qty = $ss['qty'] - $cart_qty;
                    $new_num_bought = $ss['num_bought'] + $cart_qty;
                    $data1 = $_SESSION['cart'][$skirt_id]['item'] . "\n";
                    file_put_contents($my_file1, $data1, FILE_APPEND);
                    $item->updateSkirt($id, $new_qty, $new_num_bought);
                }
                $row1 = $item->getCustomerDetails($email);
                $ss1 = $row1->fetch_array(MYSQLI_ASSOC);
                $cid = $ss1['cust_id'];
                $item->makeOrder($cid, $date);
                $mail->sendAlertMail($firstname, $lastname, $email);
                header('Location: orders.php');
            }
        }
    }
}