Question: Need PHP code, in the screenshot below the Edit button should bring up a page that edits the information listed in the table for that
Need PHP code, in the screenshot below the Edit button should bring up a page that edits the information listed in the table for that product. A drop down menu should also be shown that allows you to change the category that the product belongs to

The code for the screenshot above is listed below:
// Get category ID if (!isset($category_id)) { $category_id = filter_input(INPUT_GET, 'category_id', FILTER_VALIDATE_INT); if ($category_id == NULL || $category_id == FALSE) { $category_id = 1; } } // Get name for selected category $queryCategory = 'SELECT * FROM categories WHERE categoryID = :category_id'; $statement1 = $db->prepare($queryCategory); $statement1->bindValue(':category_id', $category_id); $statement1->execute(); $category = $statement1->fetch(); $category_name = $category['categoryName']; $statement1->closeCursor();
// Get all categories $query = 'SELECT * FROM categories ORDER BY categoryID'; $statement = $db->prepare($query); $statement->execute(); $categories = $statement->fetchAll(); $statement->closeCursor();
// Get products for selected category $queryProducts = 'SELECT * FROM products WHERE categoryID = :category_id ORDER BY productID'; $statement3 = $db->prepare($queryProducts); $statement3->bindValue(':category_id', $category_id); $statement3->execute(); $products = $statement3->fetchAll(); $statement3->closeCursor(); ?>
Product Manager
Product List
Add Product List Categories
Code Name Price Delete Edit
Thank you,
Ratings will be given upon answer
Product Manager Product List Categories Guitars Basses Drums Keyboards Synthesizer Guitars Code : Name :Price: Delete ; Edit les_paul Gibson Les Pa 1199.00 Delete Edit 2517.00 Delete Edit Sg Gibson SG fg700s Yamaha FG700S489.99 Delete Edit washburn Washburn D10S299.00 Delete Edit rodriguez Rodriguez Caballero 11 415.00Delete Edit Add Product List Categories Product Manager Product List Categories Guitars Basses Drums Keyboards Synthesizer Guitars Code : Name :Price: Delete ; Edit les_paul Gibson Les Pa 1199.00 Delete Edit 2517.00 Delete Edit Sg Gibson SG fg700s Yamaha FG700S489.99 Delete Edit washburn Washburn D10S299.00 Delete Edit rodriguez Rodriguez Caballero 11 415.00Delete Edit Add Product List Categories
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
