Creating Databases applications for the Web

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

WEB DESIGN TABLES, PAGE LAYOUT AND FORMS. Page Layout Page Layout is an important part of web design Why do you think your page layout is important?
Lecture 6/2/12. Forms and PHP The PHP $_GET and $_POST variables are used to retrieve information from forms, like user input When dealing with HTML forms.
Forms Review. 2 Using Forms tag  Contains the form elements on a web page  Container tag tag  Configures a variety of form elements including text.
Creating Web Page Forms
Creating Databases applications for the Web Reprise. Basic HTML review, forms Preview: Server side vs client side Classwork: create HTML forms and check.
1 Web Developer & Design Foundations with XHTML Chapter 6 Key Concepts.
Advance Database Management Systems Lab no. 5 PHP Web Pages.
Reading Data in Web Pages tMyn1 Reading Data in Web Pages A very common application of PHP is to have an HTML form gather information from a website's.
1 Creating Web Forms in HTML Web forms collect information from customers Web forms include different control elements including: –Input boxes –Selection.
Server-side Scripting Powering the webs favourite services.
1 HTML References: A HTML Tutorial: /HTMLPrimer.html
CSC 2720 Building Web Applications HTML Forms. Introduction  HTML forms are used to collect user input.  The collected input is typically sent to a.
Website Development with PHP and MySQL Saving Data.
Forms and Server Side Includes. What are Forms? Forms are used to get user input We’ve all used them before. For example, ever had to sign up for courses.
1 © Netskills Quality Internet Training, University of Newcastle HTML Forms © Netskills, Quality Internet Training, University of Newcastle Netskills is.
ITCS373: Internet Technology Lecture 5: More HTML.
CSC 2720 Building Web Applications Server-side Scripting with PHP.
Creating databases for Web Applications php basics. ing. phpMyAdmin to set up MySQL. Homework: Use phpMyAdmin. Make posting with [unique] source on.
XHTML & Forms. PHP and the WWW PHP and HTML forms – Forms are the main way users can interact with your PHP scrip Typical usage of the form tag in HTML.
Creating Databases applications for the Web Basic HTML review, forms Preview: Server side vs client side Flash HW: Review HTML forms and FLASH examples.
Introduction to JavaScript CS101 Introduction to Computing.
HTML Forms. Slide 2 Forms (Introduction) The purpose of input forms Organizing forms with a and Using different element types to get user input A brief.
Forms Collecting Data CSS Class 5. Forms Create a form Add text box Add labels Add check boxes and radio buttons Build a drop-down list Group drop-down.
Creating Databases for Web applications Server side vs client side PHP basics Homework: Get your own versions of sending working: both html and Flash!
+ FORMS HTML forms are used to pass data to a server. begins and ends a form Forms are made up of input elements Every input element has a name and value.
©SoftMooreSlide 1 Introduction to HTML: Forms ©SoftMooreSlide 2 Forms Forms provide a simple mechanism for collecting user data and submitting it to.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
HTML Forms.
Since you’ll need a place for the user to enter a search query. Every form must have these basic components: – The submission type defined with the method.
Creating Databases applications for the Web: week 2 Basic HTML review, forms HW: Identify unique source for asp, php, Open Source, MySql, Access.
Department of Computer Science, Florida State University CGS 3066: Web Programming and Design Spring Forms, HTML5 layout.
Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
INTERNET APPLICATIONS CPIT405 Forms, Internal links, meta tags, search engine friendly websites.
HTML Tutorial. What is HTML HTML is a markup language for describing web documents (web pages) HTML documents are described by HTML tags Each HTML tag.
Web Forms. Web Forms: A form allows our web visitors to submit information to us. Some examples uses for forms are to let the web user contact us, fill.
HTML III (Forms) Robin Burke ECT 270. Outline Where we are in this class Web applications HTML Forms Break Forms lab.
Lesson 5 Introduction to HTML Forms. Lesson 5 Forms A form is an area that can contain form elements. Form elements are elements that allow the user to.
HTML Structure II (Form) WEEK 2.2. Contents Table Form.
Simple PHP Web Applications Server Environment
Introduction to JavaScript MIS 3502, Fall 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 9/29/2016.
Tutorial 6 Working with Web Forms
Advanced HTML Tags:.
HTML CS 4640 Programming Languages for Web Applications
Web Systems & Technologies
CHAPTER 2 MARKUP LANGUAGE
Web Forms.
Web Forms.
Creating Databases Local storage. join & split
How to Write Web Forms By Mimi Opkins.
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
Introduction to Web programming
HTML IV (Forms) Robin Burke ECT 270.
Intro to PHP & Variables
Cookies BIS1523 – Lecture 23.
HTML Forms and User Input
HTML: Basic Tags & Form Tags
CISC103 Web Development Basics: Web site:
Client side & Server side scripting
Chapter 27 WWW and HTTP.
HTTP GET vs POST SE-2840 Dr. Mark L. Hornick.
Computer communications
PHP Forms and Databases.
HTML5 - 2 Forms, Frames, Graphics.
Client-Server Model: Requesting a Web Page
PHP-II.
Web Forms.
HTML CS 4640 Programming Languages for Web Applications
HTML: Basic Tags & Form Tags
Presentation transcript:

Creating Databases applications for the Web Reprise. Basic HTML review, forms Preview: Server side vs client side Classwork: create HTML forms and check query string HW: Review HTML forms

Recall What is a database? A database is made up of …. What interprets the HTML and the JavaScript? What interprets the php? What interprets the SQL? Note: I will repeat myself on this issue!

Postings ???? Please put in comments on the site, NOT just a link This is a required part of the assignment. You can edit your post. This is required (points awarded) It is helpful for all of us. It is good training. …..

Caution Chicken and egg problem: what to explain first Try some skipping ahead to motivate explanations.

Hypertext markup language Interpreted by browser on client Displays information Gathers information to send to server by invoking a php script Most typical way: HTML form <a> element with extra information in query string (explained soon) HTML5 supports some checking of information put into the form! The php interpreter works on the server to produce a html page to send to the client.

Form validation Probably should put in checks anyway: belt and suspenders However, keep in mind that the automatic validation will be done faster than whatever we write in JavaScript.

HTML review Ordinary text plus tags. Tags are singletons or pairs template for all html files: <html> <head><title> ... </title> </head> <body> ... </body> </html> This is the basic template. The stuff between the title tags shows up at the top of the screen. That and other stuff in the header can be used by search engines. The stuff within the body tags is what appears on the screen.

HTML examples (old style) <h1>My summer vacation </h1> Creating an <i>html</i> file requires attention to detail. <p> <br> <hr> <table> <tr> <td> 1 </td> <td> 2 </td> <b>3</b> </td> </tr> <tr> … </tr> </table> The heading tags (h1, h2, etc.) give a progression of sizes and emphasis. They will look different on different browsers, but h1 will be more emphatic that h2, etc. When you are producing an HTML table from data in a database, you often will be creating a table.

HTML: newer style Use styles, including new semantic elements Put as much of the formatting as possible into CSS. Recall: HTML5 logo example (also chance to introduce drawing on canvas) http://faculty.purchase.edu/jeanine.meyer/html5/html5logoscale.html

3-tier logic/implementation model Presentation content (including structure) HTML5 format CSS behavior JavaScript Business logic php Information MySQL

HTML Tables Used to display data from database! Often, [your] PHP code will generate the table tags: tr, td Note: often CSS can be used in place of tables, especially for general layout. You will see many warnings to avoid tables For tables of data, use tables!

HTML tags referencing files <img src="frog.gif"> <img src="../images/frog.gif"> <a href="next2.html"> Continue </a> <form action="takedata.php" method=get> All the file references on this page are to files on the server holding the html file (or the php file producing the html). These are all ‘relative’ addresses. Absolute addresses have http:// Method= post means the form input will be sent via the http headers. What this means to you is that it is not method=get, where the data is sent via the URL and visible to the user.

Reprise Information entered into form will be sent to the file indicated in the action attribute

Structure CLIENT Browser (Firefox): Requests URL SERVER PHP interpreter SERVER DBMS (MySQL) Build HTML page

Notes method=get produces the so-called query string. We can also generate query strings using php OR as direct call Direct calls can be done for testing method=post sends data another way (via HTTP headers). Benefit is that less is revealed to user. Another benefit is lack of clutter. Older practice in PHP could refer to POST or GET or cookies or variables in the same way. Current practice for PHP is to distinguish these. Can set up PHP implementation to go back to old, more permissive way Alternative: action="mailto:emailaddress" Repeat on get versus post.

Query string Name = value pairs Name is the name of the <input> element Value is what the person entering data into the form types in Query string will be URL?name1=value1&name2=value2… Blanks will be changed to +. May be other substitutions. Special characters, including blanks can require special handling at php end.

<form action="accepts_data.htm" method=get> placeholder <form action="accepts_data.htm" method=get> First Name <input type=text name='fname'> Last Name <input type=text name='lname'><br> Choose one <input type='radio' name='category' value='newmedia'> New Media <input type='radio' name='category' value='math'> Math/Computer science <input type='radio' name='category' value='LAS'> Other LAS <input type='radio' name='category' value='arts'> Conservatories <input type='radio' name='category' value='CE'> Continuing education <br><input type=submit value="SEND"> </form> This example is for demonstration purposes. The accepts_data.htm file doesn’t do anything. Forms contain different input types: text is the simplest one. You can also specify the size of a text field. All input fields of type radio and name the same (‘category’ in this case) work as a unit. Only one can be set at a time. The input of type submit is a button.

This shows what the last produced PLUS my input.

Script referred to by action The php file probably will contain html and code that produces html. This is reason to know the tags. The php code will be inside special delimiters REPEAT WARNING: tricky syntax. Much fussing about quotation marks. more on this later.

After clicking send Browser goes to the file indicated by the action parameter The URL for this is the following (one long string, not split into multiple lines): file:///X|/accepts_data.htm?fname=Jeanine&lname=Meyer&category=newmedia For any form, the browser takes the indicated action with the indicated method. Here is was GET, so this was the URL. AGAIN: THE URL IS ONE STRING, not split.

What is the URL in this case What is the URL in this case? To make sure you understand this, think about it, go backwards if you are looking at the notes, write down your answer and only then go forward.

Second example: file:///X|/accepts_data.htm?fname=John&lname=Smith&category=arts If this isn’t what you did, go over the last few charts.

One more example that doesn't do anything! <html> <head><title> Generate query string</title></head> <body> <h2> Coffee shop </h2> <p> <form name="orderf" action="dummy.html"> <select name="drink"> <option value="2.50">Coffee <option value="2.25">Hot Cocoa <option value="1.00">Chai </select> <br/><br/><br/><br/> <input type="radio" name="sizef" value="1">Tall <input type="radio" name="sizef" value="1.5">Grand <input type="radio" name="sizef" value="2"> Super <input type=submit value="Order"> <br> Name: <input type="text" name="name"> </form> </body> </html>

Opened and filled out form

Result (this is okay since I just want to show the query string) This webpage is not found No webpage was found for the web address:file:///C:/Documents%20and%20Settings/Jeanine/My%20Documents/php/dummy.html?drink=2.25&sizef=1.5&name=Jeanine Error 6 (net::ERR_FILE_NOT_FOUND): The file or directory could not be found.

Classwork Create an html document that has a form Open with browser and fill out form Look at query string

NOTE We/you/I can do some testing, such as this, on our own computers (client machine) BUT Most testing will need to be done on the server. upload work test edit/fix/improve, upload again There is an alternative: making a server on our own computers, but it is tedious and only postpones what needs to be done.

phpMyAdmin You can use this for setting up tables, but we also will do this using code. You also can use this for debugging: seeing what is in the tables and, possibly, removing records.

To use phpMyAdmin Need to have requested database access from CSS Download and read the README file. Use https:// First request for id/password, use your regular (email) id and password You may need to include @purchase.edu Second request: use id and pw given in README file

Homework Continue to practice producing HTMLs script with a form with investigate multiple input elements (e.g., range, radio buttons, check boxes, …) Use method=get Use placeholder action=dummy.html Submit element Test (there will be an error message since dummy.html does not exist!). Look at the query string generated Do postings of php sources if you haven't done so. Comment on others. Sign up for webspace AND database access. Will start php next class! Does not exist