Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Add all items from the database as additional drop down options cart.php Cart Contents: Add to your cart: Dog Cat Hamster items sql file drop

Add all items from the database as additional drop down options

cart.php

// get the cart out of the SESSION (if the cart is not in the SESSION, create it) if (isset($_SESSION['cart'])) { $cart = $_SESSION['cart']; } else { $cart = array(); }

if (isset($_SESSION['items'])) { $cart = $_SESSION['items']; } else { $items = array(); } // add the new item to the cart $cart[] = $_REQUEST['item'];

// put the cart back into the session (adding a new item may have resulted in a new object in memory) $_SESSION['cart'] = $cart; ?>

Cart Contents:


"; foreach ($cart as $item) { echo " $item "; } echo ""; ?>

Add to your cart:

sql file

drop database officemin; create database officemin;

use officemin; create table items (id int primary key auto_increment, brand varchar(255), product varchar(255), price decimal(5, 2) );

insert into items (brand, product, price) values ("Folgers", "Coffee", 7.99); insert into items (brand, product, price) values ("Dunder Mifflin", "Copy Paper", 53.99); insert into items (brand, product, price) values ("Philipino", "Manila Folders", 6.99); insert into items (brand, product, price) values ("HP", "Ink Cartridge", 36.99); insert into items (brand, product, price) values ("Sparkle", "Paper Towels", 8.99); insert into items (brand, product, price) values ("Gordon", "Flash Drive", 9.59);

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional SQL Server 2000 Database Design

Authors: Louis Davidson

1st Edition

1861004761, 978-1861004765

More Books

Students also viewed these Databases questions