In-Class Program: Sales System

Slides:



Advertisements
Similar presentations
Table, List, Blocks, Inline Style
Advertisements

HTML Overview - Cascading Style Sheets (CSS). Before We Begin Make a copy of one of your HTML file you have previously created Make a copy of one of your.
CHAPTER 7 STYLING CONTENT WITH CASCADING STYLE SHEETS.
MIS 425 Lecture 2 – HTML Navigation, Colors, tables and Styles Instructor: Martin Neuhard
Images, Tables, lists, blocks, layout, forms, iframes
Supplement Creating Forms. Objectives Show how forms are used How to create the Form element HTML elements used for creating input fields.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 14 Web Database Programming Using PHP.
CSS, cont. October 7, Unit 4. Generic Containers Currently, we know how to modify the properties of HTML tags using style sheets But, we can only modify.
Form Basics CS Web Data  Most interesting web pages revolve around data  examples: Google, IMDB, Digg, Facebook, YouTube, Rotten Tomatoes  can.
HTML Tables and Forms Creating Web Pages with HTML CIS 133 Web Programming Concepts 1.
CSE 154 LECTURE 9: FORMS. Web data most interesting web pages revolve around data examples: Google, IMDB, Digg, Facebook, YouTube, Rotten Tomatoes can.
Ping Zhang 10/08/2010.  You can get data from the user (input) and display information to the user (output).  However, you must include the library.
Building the User Interface by Using HTML5: Organization, Input, and Validation Lesson 3.
 ult.htm ult.htm  This website illustrates the use of CCS (style sheets)
DAT602 Database Application Development Lecture 14 HTML.
Homework for October 2011 Nikolay Kostov Telerik Corporation
INTERNAL CSS Casey Ames Different types of CSS There are three different types of CSS: ◦ External CSS ◦ Internal CSS ◦ Inline CSS In this presentation.
SERVER web page repository WEB PAGE instructions stores information and instructions BROWSER retrieves web page and follows instructions Server Web Server.
HTML Hyper Text Markup Language It is used for describing web documents or web pages. A markup language is set of markup tags. HTML documents are described.
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
Copyright 2007, Information Builders. Slide 1 Understanding Basic HTML Amanda Regan Technical Director June, 2008.
>> HTML: Structure Elements. Elements in HTML are either Inline or Block. Block-level Elements – Begins on a new line – Occupy the whole width – Stacks.
Copyright © Osmosys O S M O S Y SO S M O S Y S D e p l o y i n g E x p e r i e n c e & E x p e r t i s e™ HTML Training.
Microsoft Access 2007 Tutorial (Part II) CIS*1000*DE.
PHP Form Introduction Getting User Information Text Input.
IT Introduction to Website Development Welcome!
SERVER web page repository WEB PAGE instructions stores information and instructions BROWSER retrieves web page and follows instructions Server Web Server.
1 Review of Form Elements. 2 The tag Used in between tags.  Form elements(text control, buttons, etc.. ) goes here. OR  Form elements(text control,
HTML.
Course created by Sarah Phillips BBCD Melbourne BAPDCOM Version 1 – April 2013.
LEARN THE QUICK AND EASY WAY! VISUAL QUICKSTART GUIDE HTML and CSS 8th Edition Chapter 8: Working with Style Sheets.
DYNAMIC HTML What is Dynamic HTML: HTML code that allow you to change/ specify the style of your web pages. Example: specify style sheet, object model.
Web Page Design Forms! Website Design. Objectives What forms can do The Attributes of the form tag Using Textboxes Textareas Checkboxes Radio buttons.
External Style Sheets Exploring Computer Science – Lesson 3-6.
Higher Computing Science Coding the Web: HTML, JavaScript, PHP and MySQL.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 14 Web Database Programming Using PHP.
Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
`. Lecture Overview HTML Body Elements Linking techniques HyperText references Linking images Linking to locations on a page Linking to a fragment on.
CSD 340 (Blum)1 Introducing Text Input elements and Ifs.
01 – HTML (1) Informatics Department Parahyangan Catholic University.
INTRODUCTION ABOUT DIV Most websites have put their content in multiple columns. Multiple columns are created by using or elements. The div element is.
A gentle introduction to Bootstrap TDAP Jeremy Shafer Department of MIS Fox School of Business Temple University Spring
A little PHP. Enter the simple HTML code seen below.
HTML Extra Markup CS 1150 Spring 2017.
Web Database Programming Using PHP
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
Loops BIS1523 – Lecture 10.
Positioning Objects with CSS and Tables
Arrays: Checkboxes and Textareas
Web Database Programming Using PHP
Arrays and files BIS1523 – Lecture 15.
Intro to PHP & Variables
Cookies BIS1523 – Lecture 23.
HTML Forms and User Input
Web Systems Development (CSC-215)
Functions BIS1523 – Lecture 17.
Number and String Operations
In Class Program: Today in History
Building Web Applications
In Class Programming BIS1523 – Lecture 11.
Video Player BIS1523 – Lecture 22.
In Class Programming: Credit card payment
Video list editor BIS1523 – Lecture 24.
Web DB Programming: PHP
Text Analyzer BIS1523 – Lecture 14.
Introduction to HTML: Forms
Positioning Objects with CSS and Tables
Presentation transcript:

In-Class Program: Sales System BIS1523 – Lecture 16

Program Overview Todays project will consist of three pages: One allows the user to order some quantity of products One shows the summary of that order One shows a summary of all orders places The program will use 2 external files: Products.txt lists all of the products available Prices.txt lists the prices for those products The files are set up so that the product on row X matches the price on row X

Order Page The order page consists of a bunch of text inputs, each with a corresponding product name, and price.

Results Page The results page prints out a summary for a single order

Report Page The report page simply lists total number of orders, total revenue spent, and average. To collect this data, we’ll need to log each report into a third file called log.txt

Columns We start with some simple un-styled HTML for our three columns on the input page: In order to line up the columns, we will give these headings an ID, and style them with inline-block, and a width. Inline-block specifies that these elements should be all on the same line, they don’t start their own line We’ll use the SPAN tag to give each column a class

Columns HTML CSS Results:

Loading Data To load the files into arrays, we use the file() function We step through each element of the array, and print out a textarea, and the name and price from the array. For now we use a placeholder for the input textbox of some x’s We need to use the same SPAN classes for the columns to line up. Notice we also have to escape the quotes in them, since we are printing them with PHP

Resulting HTML Here are the results:

Quantity Input Next, we need to replace the X’s with an input that allows the user to type in a quantity. Each input needs to have a unique name. What we can do is use the loop variable $i, and name each one QTY1, QTY2, etc. The HTML produced looks like: We place that inside our SPAN tags….

QTY Results:

Results Page For the results, we are going to add an additional Column: So we add an additional SPAN, and CSS to match

Columns Much like the input page, we want to print out several columns of data. We will start by loading the files into arrays, and printing them all out.

Finding Quantity Now, we have a number of different qty variables we sent through our POST. Each has a unique number. PHP uses double quotes to say “do variable substitution here”, so we can use this format: To retrieve the quantity. Each time through the loop, the $qty variable will get set with the value of qty0, qty1, qty2, qt3, etc…..

Example

Skipping Unordered Items If we want to only print out lines that the user ordered, we use an if statement, and check to verify $qty is bigger than 0.

Totalling Price Next, we add in the math to calculate the total per line, and the overall total price

Log File In order to calculate the summary, we need to write the total of each purchase into a file. If we don’t concatenate a PHP_EOL character, the new numbers are stuck together all on one line. So, we do that concatenation, and use FILE_APPEND to stick each new value on the file. The resulting file has one number per line:

Summary For the summary, we read the list of files, total them up inside a loop, and use that total to calculate an average