www forms and search. forms url - always fetch a particular page what if the information we want...

25
WWW Forms and Search

Upload: constance-booker

Post on 12-Jan-2016

219 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: WWW Forms and Search. Forms URL - always fetch a particular page What if the information we want varies from time to time and from user to user?

WWW Forms and Search

Page 2: WWW Forms and Search. Forms URL - always fetch a particular page What if the information we want varies from time to time and from user to user?

Forms

• URL - always fetch a particular page

• What if the information we want varies from time to time and from user to user?

Page 3: WWW Forms and Search. Forms URL - always fetch a particular page What if the information we want varies from time to time and from user to user?

Forms

Page 4: WWW Forms and Search. Forms URL - always fetch a particular page What if the information we want varies from time to time and from user to user?

Forms - requests to a web-site

• How to get information from the user

• When to send the request

• Where to send the request

• How to send the user’s information with the request

Page 5: WWW Forms and Search. Forms URL - always fetch a particular page What if the information we want varies from time to time and from user to user?

<body><h1>Example form</h1>

<form action="http://icie.cs.byu.edu/cgi/findMe">

First name <input name=firstName size=20 value="Phred">

<p>Last name<input name=lastName size=20 value="Phinster">

<p><input type="submit" value="Find Me">

</form></body>

Page 6: WWW Forms and Search. Forms URL - always fetch a particular page What if the information we want varies from time to time and from user to user?
Page 7: WWW Forms and Search. Forms URL - always fetch a particular page What if the information we want varies from time to time and from user to user?

Labels

<body>

<h1>Example form</h1><form action="http://icie.cs.byu.edu/cgi/findMe">

First name

<input name=firstName size=20 value="Phred"><p>

Last name<input name=lastName size=20 value="Phinster">

<p><input type="submit" value="Find Me">

</form></body>

Page 8: WWW Forms and Search. Forms URL - always fetch a particular page What if the information we want varies from time to time and from user to user?

Labels

Page 9: WWW Forms and Search. Forms URL - always fetch a particular page What if the information we want varies from time to time and from user to user?

How to get info from the user

<body><h1>Example form</h1><form action="http://icie.cs.byu.edu/cgi/findMe">

First name

<input name=firstName size=20 value="Phred"><p>

Last name

<input name=lastName size=20 value="Phinster"><p>

<input type="submit" value="Find Me"></form></body>

Page 10: WWW Forms and Search. Forms URL - always fetch a particular page What if the information we want varies from time to time and from user to user?

Parts to an input tag

• <input name=“N” size=20>

• Name - the name that this input information will be given

• Size - the number of characters that the user can type

Page 11: WWW Forms and Search. Forms URL - always fetch a particular page What if the information we want varies from time to time and from user to user?

When to send the request

<body><h1>Example form</h1><form action="http://icie.cs.byu.edu/cgi/findMe">

First name <input name=firstName size=20 value="Phred">

<p>Last name<input name=lastName size=20 value="Phinster">

<p>

<input type="submit" value="Find Me"></form></body>

Page 12: WWW Forms and Search. Forms URL - always fetch a particular page What if the information we want varies from time to time and from user to user?

When to send the request

Page 13: WWW Forms and Search. Forms URL - always fetch a particular page What if the information we want varies from time to time and from user to user?

Where to send the request

<body><h1>Example form</h1>

<form action="http://icie.cs.byu.edu/cgi/findMe">First name <input name=firstName size=20 value="Phred">

<p>Last name<input name=lastName size=20 value="Phinster">

<p><input type="submit" value="Find Me">

</form></body>

Page 14: WWW Forms and Search. Forms URL - always fetch a particular page What if the information we want varies from time to time and from user to user?

How to send the user informationin a URL

<body><h1>Example form</h1><form action="http://icie.cs.byu.edu/cgi/findMe">

First name <input name=firstName size=20 value="Phred">

<p>Last name<input name=lastName size=20 value="Phinster">

<p><input type="submit" value="Find Me">

</form></body>

http://icie.cs.byu.edu/cgi/findMe?firstName=Phred&lastName=Phinster

Page 15: WWW Forms and Search. Forms URL - always fetch a particular page What if the information we want varies from time to time and from user to user?

How to send the user informationin a URL

<body><h1>Example form</h1><form action="http://icie.cs.byu.edu/cgi/findMe">

First name <input name=firstName size=20 value="Phred">

<p>Last name<input name=lastName size=20 value="Phinster">

<p><input type="submit" value="Find Me">

</form></body>

http://icie.cs.byu.edu/cgi/findMe?firstName=Phred&lastName=Phinster

Page 16: WWW Forms and Search. Forms URL - always fetch a particular page What if the information we want varies from time to time and from user to user?

How to send the user informationin a URL

<body><h1>Example form</h1><form action="http://icie.cs.byu.edu/cgi/findMe">

First name <input name=firstName size=20 value="Phred">

<p>Last name<input name=lastName size=20 value="Phinster">

<p><input type="submit" value="Find Me">

</form></body>

http://icie.cs.byu.edu/cgi/findMe?firstName=Phred&lastName=Phinster

Page 17: WWW Forms and Search. Forms URL - always fetch a particular page What if the information we want varies from time to time and from user to user?

Forms - How does the server respond?

• Not every URL refers to a page

• CGI - Common Gateway Interface

• You can give a server a program and place it at a URL.

• The server will then run the program and return its result rather than fetch a page

Page 18: WWW Forms and Search. Forms URL - always fetch a particular page What if the information we want varies from time to time and from user to user?

Search

• How do we describe the page that we want?

Page 19: WWW Forms and Search. Forms URL - always fetch a particular page What if the information we want varies from time to time and from user to user?

Search

• How does Google know where that page is?

• Find as many web pages as you can

• For each web page prepare a list of words on that page

• For each word in all of the web keep a list of pages that have that word

Page 20: WWW Forms and Search. Forms URL - always fetch a particular page What if the information we want varies from time to time and from user to user?

How does your browser ask for the search

Page 21: WWW Forms and Search. Forms URL - always fetch a particular page What if the information we want varies from time to time and from user to user?

CS 100 - Which page?

Page 22: WWW Forms and Search. Forms URL - always fetch a particular page What if the information we want varies from time to time and from user to user?

CS 100 - the winner

• Why? Both have the words CS 100

• CS 100 in <title>

• CS 100 in text

Page 23: WWW Forms and Search. Forms URL - always fetch a particular page What if the information we want varies from time to time and from user to user?

Problems with word searches

• Search for “doctor”

• What about pages with the word “doctors”?• What about pages with the word “physicians”?• What about pages about “witch doctors”?• What if the page only has a picture of a doctor?• What if the only use of the word doctor is in a

picture?

Page 24: WWW Forms and Search. Forms URL - always fetch a particular page What if the information we want varies from time to time and from user to user?

Blocking pornography

• The reverse of the search problem

• I don’t want pages that have this– How do you describe what you don’t want?

Page 25: WWW Forms and Search. Forms URL - always fetch a particular page What if the information we want varies from time to time and from user to user?

Blocking pornography

• Keep a list of all bad sites– If site is on the black list then refuse to make an

Internet connection– What if someone creates a new site?

• Keep a list of bad words and block any URL or page that has those words– What about “Middlesex, England”?– What about “breast cancer”?– What about slang words?– What about pictures?