Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an...

103
Web Programming Dr Ahmed A. Eltahawy

Transcript of Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an...

Page 1: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

Web ProgrammingDr Ahmed A. Eltahawy

Page 3: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

Course Content

HTML

CSS

Java Script

PHP

Web Database

Page 4: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

WWWThe World Wide Web (WWW) is an information space where documents and other web resources are located

Web is identified by URLs,

Web interlinked by hypertext links,

Web can be accessed via the Internet.

Invented by English scientist Tim Berners-Lee in 1989.

He wrote the first web browser in 1990

Page 5: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

URl

Hyperlink

Page 6: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

Web Design vs web development

Web Design The customer-facing part of

the website Layout

how the page looks Static

Photoshop HTML CSS

Javascript

Web development The back-end of the website

Programming interactions on the pages

Action Dynamic

HTML PHP

Python

Page 7: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

Web Design- Selected steps for perfect web designing

1.Put your thoughts on paper first

2.Start draw what you think

3.Add a grid: for layout

4.Choose your typography: font

5.Select your Color theme

6. Divide the layout: Each section in your site needs to tell a story.

Page 8: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

Web Design

1.What could be a part of the website layout:

1.Text: In what container: Text box, Label ,Combo

2.Button

3.Image

4.Video

5.Link

Page 9: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML: Hyper Text Markup Language

Page 10: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML

A markup language is a set of markup tags

described by HTML tags

Each HTML tag describes different document content

Page 11: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML Editor

1.Open your editor

2.write your HTML code

3.Save as .HTML

4.Open from browser

Page 12: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML

HTML tags are the hidden keywords within a web page

Define how the browser must format and display the content

Most tags must have two parts, an opening and a closing part

Page 13: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML Tags<tagname>content</tagname>

HTML tags normally come in pairs like <p> and </p>

The first tag in a pair is the start tag

The second tag is the end tag

The end tag is written like the start tag, but with a slash before the tag name

Page 14: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified
Page 15: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTMLThe DOCTYPE declaration defines the document type to be HTML

The text between <html> and </html> describes an HTML document

The text between <head> and </head> provides information about the document

The text between <title> and </title> provides a title for the document

The text between <body> and </body> describes the visible page content

The text between <h1> and </h1> describes a heading

The text between <p> and </p> describes a paragraph

Page 16: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML StructureHTML Documents

All HTML documents must start with a type declaration:

<!DOCTYPE html>.

The HTML document itself begins with:

<html> and ends with </html>.

The visible part of the HTML document is between:

<body> and </body>.

Page 17: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified
Page 18: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML ElementsHTML Headings

HTML headings are defined with the <h1> to <h6> tags:

<h1>This is a heading</h1>

<h2>This is a heading</h2>

<h3>This is a heading</h3>

Page 19: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

H1

H6

Page 20: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

ParagraphHTML Paragraphs

HTML paragraphs are defined with the

<p> text </p> (ignore spacing or new line)

<p>This is a paragraph.</p>

<p>This is another paragraph.</p>

<br> new line

<pre> </pre> specify with the same formatting

Page 21: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified
Page 22: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML Attributes Lang Attribute

The document language can be declared in the <html> tag.

The language is declared in the lang attribute.

<!DOCTYPE html> <html lang="en-US">

<body> <h1>My First Heading</h1>

<p>My first paragraph.</p> </body> </html>

Page 23: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML Attributes Title Attribute

HTML paragraphs are defined with the <p> tag.

In this example, the <p> element has a title attribute. The value of the attribute is “Paragraph title":

<!DOCTYPE html> <html lang="en-US">

<body> <h1>My First Heading</h1>

<p title=“Paragraph title”>My first paragraph.</p>

</body> </html>

Page 24: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML Attributes Quote Attribute

Double style quotes are the most common in HTML, but

single style can also be used.

When used both:

<p>”This is ‘single’”

Page 25: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML Attributes Quote Attribute

<b>bold</>

<I>Italic</I>

<U>underline<\u>

<hr> Horizontal line

Page 26: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML Attributes HTML Styles

style=“property:value;”

style="color:blue;"

style=“background-color:lightgrey;"

style=“font-family:verdana;"

style=“font-size:300%;"

style="text-align:center;"

<!DOCTYPE html> <html>

<body>

<h2 style="color:red;">I am red</h2>

<h2 style="color:blue;">I am blue</h2>

</body> </html>

Page 27: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

Ref

https://en.wikipedia.org/wiki/World_Wide_Web

http://www.purelybranded.com/insights/web-design-or-web-development-whats-the-difference/

http://www.w3schools.com/html/html_intro.asp

Page 28: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

Web ProgrammingDr Ahmed A. Eltahawy

Misr International University (MIU) School Of Computer Science

Page 29: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML-Comments

<!DOCTYPE html> <html>

<body>

<!-- This is a comment --> <p>This is a paragraph.</p>

<!-- Comments are not displayed in the browser -->

</body> </html>

<!-- This is a comment -->To write a comment inside your HTML code:

What is the output of:

Page 30: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML-Comments

<!DOCTYPE html> <html>

<body>

<!-- This is a comment <p>This is a paragraph.</p>

<!-- Comments are not displayed in the browser -->

</body> </html>

What is the output of:

Page 31: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML-Links

The link in HTML is performed as:

Example:

<a href="url">link text</a>

Click here

Open this

<a href=“google.ca”>Open Google</a>

Page 32: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML-Links- ColorsWhat is the output:

What is the output:

<a href=“http://www.facebook.com”>Open Facebook now</a>

<a href=“http://www.facebook.com”>Open Facebook </a>now

Page 33: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML-Links- Proprieties

<a href=“http://www.facebook.com” target=“_blank”>Open Facebook </a>

Page 34: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML-imagesPut an image inside your web using:

<img src="url" alt=“some_text">

url: the location of the image (your computer or another website)

alt: Text that appear if image not available or could not be appear

<img src="2.png" alt="appear if image not available">

Page 35: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML-images

You can use image from another website:

<img src="http://www.w3schools.com/images/w3schools_green.jpg" alt="W3Schools.com">

Control the size of the image

<img src="url" alt=“some_text" width="128" height="128">

Page 36: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML-images Float style

Style:: Float: Direct the location of the image left or right

<img src="url" alt=“some_text" width="128" height="128" style="float:right;">

<img src="http://www.w3schools.com/images/w3schools_green.jpg" alt="W3Schools.com"style="float:right;">

Page 37: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML-images image as links

<a href=“http://www.facebook.com”> <img src="2.png" alt="appear if image not available">

</a>

The image location link opened when image clicked

Page 38: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML-images image as links

<a href=“http://www.facebook.com”> <img src="2.png" alt="appear if image not available">

</a>

<a href=“http://www.facebook.com”> <img src="2.png" Facebook alt="appear if image not available">

</a>

What is the output:

Page 39: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

Ref

https://en.wikipedia.org/wiki/World_Wide_Web

http://www.purelybranded.com/insights/web-design-or-web-development-whats-the-difference/

http://www.w3schools.com/html/html_intro.asp

Page 40: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

Web ProgrammingDr Ahmed A. Eltahawy

Misr International University (MIU) School Of Computer Science

Page 41: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML-table

Start with <table> and end with </table>

<tr> </tr> for each row:

<th>text</th> : the header

<td></td> for table data (column)

<caption>Monthly savings</caption>

<table style="width:100%"> <tr>

<td>text</td> <td>text</td> <td>50</td>

</tr> <tr>

<td>text</td> <td>text</td>

</tr> </table>

Page 42: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML-table - border

<table border="1" style="width:100%"> <tr>

<td>Ahmed</td> <td>50</td>

</tr> <tr>

<td>Mohamed</td> <td>60</td>

</tr> </table>

Set border at the table header will apply on all table

Page 43: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML-table - columnspan

<th colspan="2">Telephone</th>

Expand the column into two cells

<th rowspan="2">Telephone:</th>

expand into two rows

Page 44: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML-Lists

Unordered List:

Item

Item

Item

Item

Page 45: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML-Lists

Ordered List:

1.First item

2.Second item

3.Third item

4.Fourth item

Page 46: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML- Unordered Lists

<ul>

<li>Coffee</li>

<li>Tea</li>

<li>Milk</li>

</ul>

Coffee

Tea

Milk

Page 47: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML- Unordered Lists

<ul style="list-style-type:disc">

<li>Coffee</li>

<li>Tea</li>

<li>Milk</li>

</ul>

• Coffee

• Tea

• Milk

Page 48: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML- Unordered Lists

Style Description

list-style-type:disc:The list items will be marked with bullets (default)

list-style-type:circle The list items will be marked with circles

list-style-type:square The list items will be marked with squares

list-style-type:none The list items will not be marked

Page 49: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML- ordered Lists

<ol>

<li>Coffee</li>

<li>Tea</li>

<li>Milk</li>

</ol>

1.Coffee

2.Tea

3.Milk

Page 50: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML- Unordered Lists

Type The list items will be

type="1" Numbered with numbers (default)

type="A" Numbered with uppercase letters

type="a" Numbered with lowercase letters

type="I" Numbered with uppercase roman numbers

type="i" Numbered with lowercase roman numbers

Page 51: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML- ordered Lists

<ol type="I">

<li>Coffee</li>

<li>Tea</li>

<li>Milk</li>

</ol>

I.Coffee

II.Tea

III.Milk

Page 52: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML- Description Lists

A description list is a list of terms, with a description of each term.

Term

- Description

• <dl> tag defines the description list,

• <dt> tag defines the term (name), and

• <dd> tag describes each term:

Page 53: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML- ordered Lists

<dl>

<dt>Coffee</dt>

<dd>- black hot drink</dd>

<dt>Milk</dt>

<dd>- white cold drink</dd>

</dl>

Coffee - black hot drink

Milk - white cold drink

Page 54: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML- Nested Lists

<ul>

<li>Coffee</li>

<li>Tea

<ul>

<li>Black tea</li>

<li>Green tea</li>

</ul>

</li>

<li>Milk</li>

</ul>

Page 55: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML- Span

<h1>My <span style="color:red">Important</span> Heading </h1>

Span make different block inline.

used in text

My Important Heading

Page 56: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

Ref

https://en.wikipedia.org/wiki/World_Wide_Web

http://www.purelybranded.com/insights/web-design-or-web-development-whats-the-difference/

http://www.w3schools.com/html/html_intro.asp

Page 57: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

<ol type="I">

<li>Coffee</li>

<ol type="1">

<li> a</li>

<li> b</li>

</ol>

<li>Tea</li>

<li>Milk</li>

</ol>

Page 58: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML- div

<div> </div> book a block in which you can include more HTML elements

<div style="background-color:black; color:white; padding:20px;">

<h2>London</h2>

<p>London is the capital city of England. It is the most populous city in the United Kingdom, with a metropolitan area of over 13 million inhabitants.</p>

</div>

Page 59: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

a

table, th, td { border: 1px solid black;

}

We can customize using Style CSS:

border-collapse: collapse;

th, td {

padding: 15px;

}

Page 60: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML-table - CSS

table, th, td { border: 1px solid black; border-collapse: collapse; } th, td { padding: 15px; } th,td { text-align: center; } table { border-spacing: 15px; }

Page 61: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML- CSS Cascading Style Sheets

CSS could be available using:

Inline - using a style attribute in HTML elements

Internal - using a <style> element in the HTML <head> section

External - using one or more external CSS files

Page 62: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML- CSS Cascading Style Sheets

1- Inline - using a style attribute in HTML elements:

The CSS will apply on that element only

<h1 style="color:blue;">This is a Blue Heading</h1>

Page 63: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML- CSS Cascading Style Sheets

Internal - using a <style> element in the HTML <head> section:

The style will be applied on the HTML page

<style>

body {background-color:lightgrey;}

h1 {color:blue;}

p {color:green;}

</style>

Page 64: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML- CSS Cascading Style Sheets

External - using one or more external CSS files The style will be applied on the HTML page:

Link a separate style sheet with your page

Allows you to link more than one page to the sheet

Allows you to change the style of more than one page by changing single file

<head>

<link rel="stylesheet" href="styles.css">

</head>

Page 65: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML- CSS Cascading Style Sheets

<head>

<link rel="stylesheet" href="styles.css">

</head>

—————————————Style.css sheet————————————

body {

background-color: lightgrey;

}

h1 {

color: blue;

}

p {

color:green;

}

Page 66: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML- CSS Cascading Style Sheets

h1 {

color: blue;

font-family: verdana;

font-size: 300%;

border: 1px solid black;

margin: 50px;

padding: 10px;

}

Page 67: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML- CSS Cascading Style Sheets

ID: using to link specific style to one element:

<p id="p01">I am different</p>

#p01 {

color: blue;

}

Page 68: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML- CSS iframes

insert a website inside your website:

<iframe src="URL"></iframe>

<iframe src="b.html"></iframe>

Page 69: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

Ref

https://en.wikipedia.org/wiki/World_Wide_Web

http://www.purelybranded.com/insights/web-design-or-web-development-whats-the-difference/

http://www.w3schools.com/html/html_intro.asp

Page 70: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

Web Programming

Dr Ahmed A. Eltahawy

Misr International University (MIU) School Of Computer Science

Page 71: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML-Symbols

Page 72: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML-Symbols

Page 73: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML-Symbols

Page 74: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML-Form

Form are used to receive user input, And

Make some action based on input, Or

Submit the data

<form>

</form>

Page 75: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML-Form Input elements:

Text: write text on

Radio buttons: Select a choice

Submit Button: Click to do some action

Password

Checkbox

Button

others

<input type="text" name="lastname" options>

Page 76: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML-Form inputs

Page 77: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML-Form Text: <input type="text" name="firstname">

<form>

First name:<br>

<input type="text" name="firstname"><br>

Last name:<br>

<input type="text" name="lastname">

User password:<br>

<input type="password" name="psw">

Quantity (between 1 and 5): <br>

<input type="number" name="quantity" min="1" max="5">

</form>

Page 78: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML-Form Adding Restrictions

<form>

Enter a date before 1980-01-01:

<input type="date" name="bday" max="1979-12-31"> <br>

Enter a date after 2000-01-01:

<input type="date" name="bday" min="2000-01-02"> <br>

</form>

Page 79: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML-Form

Radio: <input type="radio" >

<form>

<input type="radio" name="gender" value="male" checked> Male <br>

<input type="radio" name="gender" value="female"> Female <br>

<input type="radio" name="gender" value="other"> Other

</form>

Page 80: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML-Form

checkbox: <input type="checkbox" >

<form>

<input type="checkbox" name="vehicle1" value="Bike">

I have a bike<br>

<input type="checkbox" name="vehicle2" value="Car">

I have a car

</form>

Page 81: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML-Form

button: <input type="button" >

<form>

<input type="button" onclick="alert('Hello World!')" value="Click Me!">

</form>

Page 82: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML-Form Submit: <input type="submit">

<form action="action_page.php">

First name:<br>

<input type="text" name="firstname" value="Mickey">

<br>

Last name:<br>

<input type="text" name="lastname" value="Mouse">

<br><br>

<input type="submit" value="Submit">

</form>

When Click

Values sent here

Page 83: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML-Form

• <form action="action_page.php" method = "Get">

• Searching without secret information

• The values will appear at the title when submitting

• <form action="action_page.php" method = "Post">

• If contain secure information like password

Page 84: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML-Form

Page 85: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML-Form <form action="action_page.php">

<fieldset>

<legend>Personal information:</legend>

First name:<br>

<input type="text" name="firstname" value="Mickey"><br>

Last name:<br>

<input type="text" name="lastname" value="Mouse"><br><br>

<input type="submit" value="Submit">

</fieldset>

</form>

Group elements together

Give the group a name

Page 86: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML-Form Input attributes1.Value: specifies the initial value for an input

<form action="">

First name:<br>

<input type="text" name="firstname" value="John">

<br>

Last name:<br>

<input type="text" name="lastname">

</form>

Page 87: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML-Form Input attributes2.Read only: the input field is read only (cannot be changed)

<form action="">

First name:<br>

<input type="text" name="firstname" value="John" readonly>

<br>

Last name:<br>

<input type="text" name="lastname">

</form>

Page 88: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML-Form Input attributes3.Disable: the input field is disable

<form action="">

First name:<br>

<input type="text" name="firstname" value="John" disabled >

<br>

Last name:<br>

<input type="text" name="lastname">

</form>

Page 89: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML-Form Input attributes4.The size : specifies the size (in characters) for the input

field:<form action="">

First name:<br>

<input type="text" name="firstname" value="John" size="40">

<br>

Last name:<br>

<input type="text" name="lastname">

</form>

Page 90: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML-Form Input attributes5.The maxlength:specifies the maximum allowed length for the

input field:

<form action="">

First name:<br>

<input type="text" name="firstname" value="John" maxlength="10">

<br>

Last name:<br>

<input type="text" name="lastname">

</form>

Page 91: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML-Form Input attributes6.The autocomplete attribute:

✤ specifies whether a form or input field should have autocomplete on or off.

✤When autocomplete is on, the browser automatically complete values based on values that the user has entered before.

✤Tip: It is possible to have autocomplete "on" for the form, and "off" for specific input fields, or vice versa.

✤The autocomplete attribute works with <form> and the following <input> types:

✤text, search, url, tel, email, password, datepickers, range, and color.

Page 92: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML-Form Input attributes6.The autocomplete attribute:

<form action="action_page.php" autocomplete="on">

First name:<input type="text" name="fname"><br>

Last name: <input type="text" name="lname"><br>

E-mail: <input type="email" name="email" autocomplete="off"><br>

<input type="submit">

</form>

Page 93: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML-Form Input attributes

7.The Nonvalidate attribute: is a form attribute. Means submit the data with no validation

<form action="action_page.php" novalidate>

E-mail: <input type="email" name="user_email">

<input type="submit">

</form>

Page 94: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML-Form Input attributes

8.Auto focus: <input> element should automatically get focus when the page loads

<form action="action_page.php" autofocus >

E-mail: <input type="email" name="user_email">

<input type="submit">

</form>

Page 95: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML-Form Input attributes9.Form: refere to form with specific id

<form action="action_page.php" id="form1">

First name: <input type="text" name="fname"><br>

<input type="submit" value="Submit">

</form>

Last name: <input type="text" name="lname" form="form1">

Page 96: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML-Form Input attributes

10.Height and Width:

<form action="action_page.php" id="form1">

First name: <input type="text" name="fname"><br>

<input type="image" src="2.png" alt="Submit" width="48" height="48">

</form>

Page 97: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML-Form Min-Max

<form>

Enter a date before 1980-01-01:

<input type="date" name="bday" max="1979-12-31"> <br>

Enter a date after 2000-01-01:

<input type="date" name="bday" min="2000-01-02"> <br>

</form>

Page 98: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML-Form Elements

1.The Select: drop down menu to select from

<select name="cars">

<option value="volvo">Volvo</option>

<option value="toyota">Toyota</option>

<option value="fiat" selected>Fiat</option>

<option value="audi">Audi</option>

</select>

Page 99: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML-Form Elements

1.Text area: multi line text input:

2.Textarea of ten rows and 30 columns:

<textarea name="message" rows="10" cols="30">

Initial Text here

</textarea>

Page 100: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML-Form Elements

1.Button: should linked with action when clicked

<button type="button" onclick="alert('Hello World!')">Click Me!

</button>

Page 101: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML5-Form Elements <form action="action_page.php">

<input list="browsers">

<datalist id="browsers">

<option value="Internet Explorer">

<option value="Firefox">

<option value="Chrome">

<option value="Opera">

<option value="Safari">

</datalist>

</form>

Page 102: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

HTML5-Form Elements

Page 103: Web Programming - Facultu of tourism · 2018. 8. 30. · WWW The World Wide Web (WWW) is an information space where documents and other web resources are located Web is identified

Ref

https://en.wikipedia.org/wiki/World_Wide_Web

http://www.purelybranded.com/insights/web-design-or-web-development-whats-the-difference/

http://www.w3schools.com/html/html_intro.asp