In Class Programming BIS1523 – Lecture 11.

Slides:



Advertisements
Similar presentations
JQuery MessageBoard. Lets use jQuery and AJAX in combination with a database to update and retrieve information without refreshing the page. Here we will.
Advertisements

HTML Basics Customizing your site using the basics of HTML.
Table (TABLE) Contains TABLE ROWS (TR) Contains TABLE DATA (TD) Data can contain anything Text Lists Other tables Pictures …
Copyright 2007, Information Builders. Slide 1 Implementing On-Click Functionality With the HTML Layout Painter Larry J Braun Education Specialist June,
There is a certain way that an HTML file should be set up. The HTML section declares a beginning and an ending. Within the HTML, there should be a HEAD.
ETT 429 Spring 2007 Web Design I.
Creating Tables in a Web Site Using an External Style Sheet HTML5 & CSS 7 th Edition.
HTML CODING Text output is black and white text that opens in NOTE pad. These files can be saved and used in other programs.
Tutorial #9 – Creating Forms. Tutorial #8 Review – Tables Borders (table, gridlines), Border-collapse: collapse; empty-cells: show; and rowspan, colspan.
Intro to Excel - Session 7.11 Tutorial 7 - Session 7.1 Developing an Excel Application.
JavaScript Form Validation
INTRODUCTORY Tutorial 7 Creating Tables. XP New Perspectives on Blended HTML, XHTML, and CSS2 Objectives Discern the difference between data tables and.
HTML basics exercises.
JavaScript Lecture 6 Rachel A Ober
Views Carol Wolf Computer Science. Extended Ruby  Views files are written in extended Ruby, erb.  They end in.html.erb.  Ruby code is intermixed with.
CHAPTER 10 Formatting Tables and Forms. Using Tables the Right Way  HTML and XHTML have a LOT of tags dedicated to building a table  If you have only.
_______________________________________________________________________________________________________________ PHP Bible, 2 nd Edition1  Wiley and the.
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
Extending HTML CPSC 120 Principles of Computer Science April 9, 2012.
 HTML is hypertext markup language. It is a way for people to display their information with more complex pictures and text displays. Before HTML, messages.
Chapter 2 Web Page Design Mr. Gironda. Elements of a Web Page These are things that most web pages use.
PHP Form Introduction Getting User Information Text Input.
1 TECH1001 Lecture 6 Electronic Publishing and Production 1 More About Tables.
CIS234A- Lecture 7 Instructor Greg D’Andrea. Tables A table can be displayed on a Web page either in a text or graphical format. A text table: – contains.
Lecture 2 Conditional Statement. chcslonline.org Conditional Statements in PHP Conditional Statements are used for decision making. Different actions.
Advanced Topics Lecture 8 Rachel A Ober
® IBM Software Group © 2006 IBM Corporation JSF Rich Text Area Component This Learning Module describes the use of the JSF Rich Text Area component – for.
Document Object Model Nasrullah. DOM When a page is loaded,browser creates a Document Object Model of the Page.
Learning Aim C.  In this section we will look at how text, tables, forms and frames can be used in web pages.
Tables creating a table within a web page. What makes up a table? Columns Rows.
Advanced HTML Tags:.
Section 4.1 Section 4.2 Format HTML tags Identify HTML guidelines
CSE 154 Lecture 17: HTML tables.
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
Organizing Content with Lists and Tables
Applying CSS to Tables Stylish Tables.
Loops BIS1523 – Lecture 10.
Arrays: Checkboxes and Textareas
Bare bones notes.
HTML Tables CS 1150 Spring 2017.
Creating Tables in a Web Site Using an External Style Sheet
Computer Concepts I and II Sue Norris
Arrays and files BIS1523 – Lecture 15.
Chapter 5: Looping Starting Out with C++ Early Objects Seventh Edition
4. Javascript Pemrograman Web I Program Studi Teknik Informatika
Web Programming– UFCFB Lecture 17
Intro to PHP & Variables
Cookies BIS1523 – Lecture 23.
While Loops BIS1523 – Lecture 12.
HTML Forms and User Input
More Selections BIS1523 – Lecture 9.
Functions BIS1523 – Lecture 17.
Conditions and Ifs BIS1523 – Lecture 8.
Number and String Operations
Unit 9.3 Learning Objectives Review database access in code
In Class Program: Today in History
In-Class Program: Sales System
Building Web Applications
Lecture 25: SQL and HTML tables
Introduction to Web Authoring
In Class Programming: Credit card payment
Video list editor BIS1523 – Lecture 24.
Introduction to Web Authoring
Text Analyzer BIS1523 – Lecture 14.
Computer communications
Using tables in HTML Goes in order with Examples at my site.
Principles of Web Design 5th Edition
Basic Lessons 5 & 6 Mr. Kalmes.
HTML Forms What are clients? What are servers?
Presentation transcript:

In Class Programming BIS1523 – Lecture 11

Supply and Demand Today we are going to write a program to forecast quantity and price of a commodity. We are going to use CSS, data validation, single form design, ifs and loops to accomplish this.

Input The starting input form is divided into three sections: header, #description, #io. The three inputs are named: years, quant, and price Rather than being an .html document, this is a .php document, the calculate button calls this form, not a separate one.

PHP Outline When the user clicks the submit button, the submit value gets sent to the program. If the web site is visted by another means, the submit value is not set. For our PHP, we need to do an outline that looks like: If (empty($_POST[‘submit’])) { display the input page } else { do the PHP to input, calculate, and display the output }

Submit Detection We’ll start with an if statement just after the header, and test it. Next, rather than having it print “button not clicked”, let’s have it print the entire HTML for the input. Copy the HTML into the if statement, and place it inside a print command

Output Sections Next, we need to print out the HTML for the output section that doesn’t include any calculations. We have a description and io section Our calculations and output will go between the start and end tags for the io section

Input & Loop We use assignment statements to read in the three inputs. We will use a for loop to print out the table.

Calculations For each year, we need to calculate a new quantity and price. We don’t need separate variables, we can just use the existing $quant and $price variables. The output is unformatted, and hard to read, but we can look at it to see that the calculations are being done correctly.

Adding a Table To put our output into a table, we need to output the <table>, <tr>, <th> and <td> tags in the appropriate place. (Both start and end tags).

Formatting the Table Next, we need to add CSS to format the table. We include borders for table, td, and th, and the collapse attribute We change the background color of the header row And finally set an alternating color for every odd row

Data Validation The last step is to do some data validation. We want to check to make sure out inputs are numeric, and in range. We can include a span tag to give the error messages an ID, so we can style them with CSS making them more noticeable.

Flag Variable In order to prevent our output from being printed if there is an error, we’ll add a flag variable called $okay. We start it at “true”, and set it “false” if any errors are found in the input. Then, we put our calculate and output section inside an if statement that only runs if $okay is still TRUE.