<?php // get product id $product_id = isset($_GET['product_id']) ? $_GET['product_id'] : die('ERROR: Product ID not found.'); // include database and object files include_once '../config/database.php'; include_once '../objects/courses.php'; // instantiate database and product object $database = new Database(); $db = $database->getConnection(); // initialize object $product = new Product($db); // set product id property $product->ID = $product_id; // read single product $product->readOne(); ?> <!--we have our html form here where new product information will be entered--> <form id='update-product-form' action='#' method='post' border='0'> <table class='table table-bordered table-hover'> <tr> <td>Course Name</td> <td><input type='text' name='name' class='form-control' value='<?php echo htmlspecialchars($product->name, ENT_QUOTES); ?> ' required /></td> </tr> <tr> <td>Course Description</td> <td> <textarea name='description' class='form-control' required><?php
include_once "objects/product.php"; include_once "objects/category.php"; include_once "objects/product_image.php"; // get database connection $database = new Database(); $db = $database->getConnection(); // initialize objects $product = new Product($db); $category = new Category($db); $product_image = new ProductImage($db); // get ID of the product to be edited $id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: missing ID.'); // set the id as product id property $product->id = $id; // to read single record product $row = $product->readOne(); // set page title $page_title = $product->name; // include page header HTML include_once 'layout_head.php'; ?> <!-- HTML form for viewing a product --> <table class='table table-hover table-responsive table-bordered margin-1em-zero'> <tr> <td colspan='2'> <?php // set product id $product_image->product_id = $id; // read all related product image $stmt_product_image = $product_image->readAll();