For our final project: a little web application...
Your client, Bazaar Ceramics, currently runs a brochure web site to display their products. After conducting a gap analysis they have decided to include e-commerce functionality into this site. It is intended that the brochure site be extended to include an online catalogue and an ordering system. Initially they want to develop a prototype to test the feasibility of the e-commerce system. The prototype will implement a limited database, online catalogue and ordering system. The specifications for the prototype is shown below.
Prototype specifications
Database
A MySQL database will be developed with three tables:
o products. The products table has the following fields:
§ productid (primary key, not null, auto increment)
§ productname
§ productdesc
§ colour
§ price
§ imagepath (this will need to be the relative path that you would use in an img tag – eg images/products/product1.jpg)
o customers. The customers table has the following fields (add more if you wish)
§ customerid (primary key, not null, auto increment)
§ gname
§ fname
§ address
o purchases. The purchases table is used to store information about the products the customer wishes to order (the shopping cart).
The table has the following fields:
§ invoiceid (primary key, not null, auto increment)
§ customerid
§ cart. There are a number of ways of implementing this. To keep it simple you could declare the cart of type varchar(255). The cart variable could then be a list of comma delimited values.
For example if the customer purchases 5 boxes of blank cd’s (productid = 1) and 3 bunches of roses (productid=2), then the cart variable should have the value set to 1,5,2,3. This will require some processing in your PHP script to format the cart data correctly.
HTML Forms and PHP
Create a web page (getCustomerDetails.htm) that displays a form to gather customer details. See figure 1. When the user clicks the submit button, the form data should be posted to a PHP script (processCustdetails.php) for validation.
If the data is valid, this script should add the customer details to the database and a confirmation page with the customer’s id should be displayed. See figure 2.
If the data is not valid, the getCustomerDetails.htm page should be displayed again.
Figure 1: getCustomerDetails.htm
Figure 2: Response from valid processing
- Create a web page (showCustomers.php) that displays a list of names for all the registered customers. Next to each name include links to 2 php pages: deleteCustomer.php (which deletes that customer when called) and editCustomer.php, which loads the customer details into a form for editing (and which calls a third page: updateCustomer.php. After executing deleteCustomer.php or updateCustomer.php the user should be redirected back to the showCustomers.php page. At the bottom of the showCustomers.php page should be an ‘Add a customer’ link to the getCustomerDetails.htm page you created earlier.
Deliverables
Create the customers table in your MySQL database. Upload all your htm and php files and submit a URL to the showCustomers.php page for testing.
www.flickr.com/photos/14721869@N02/2680418274