CS 203 Lab. 4

Date on course page

Today, you will add a form to your pages, and start thinking about learning to program in php. Next Lab you will write your own PHP script to send back something showing you have received the form information.
The week after that, you will add saving the information on a file. Note: In general only work that is linked from your index.html will receive credit.

Instructions

Please indicate that your lab is ready for marking by filling out a form that is below

In the lab, the goals are:

  1. To add a form to your pages (either add to index.html, another of your pages, or put form on a new page, and put a link to it in index.html.)
  2. To put your new and revised html pages on osiris. You will learn to use 3 standard command line internet services, in addition to what you learned last week. It is good to know about typing commands, because it is often faster and more convienent than using graphical interfaces.

Please note: UNIX is case sensitive! Both user names and file names must be typed in the correct case. Lower case is the most usual.

Forms:

A form is the logical unit of information that is transferred to an action (a URL, usually a page containing PHP code), using a method of GET or POST.

For today, the action should be one of:


Absolute, will work even while viewing local copy
On same server, will only
work once form is at osiris
PHP code to simply show the values sent
https://osiris.ubishops.ca/jensen/echo.php /jensen/echo.php

Examples:

<form action="/jensen/echo.php" method="GET">
<form action="https://osiris.ubishops.ca/jensen/echo.php" method="POST">

GET is the default, the other option is POST. In either case a query string is formed. With GET, it is added to the URL, with POST it is transmitted like a file. This is useful of you expect a lot of text, or wish to hide passwords from prying eys.

You can refer to "HTML quick reference",  the guide included in the course pack, or my notes there.
The form ends, as usual, with a </form> tag. Within it, there can be any normal HTML (be sure to label your form elements!), and also the following value-producing tags:

What to do today:

  1. Have a set of pages, linked together, that tell some kind of story: About yourself, about a group, about a company you run, or imagine. (If you invent a fictious organization, be sure to put a disclaimer, saying that this is a student project, and that "Space vacations.com" is not an operating company.)
  2. Make sure that you have one page with the file name index.html, then be sure that it always contains links to your other pages (use a relative link, i.e. just the file name.)
  3. Construct a form on your main page or another page, to gather some information for the story you are telling. For instance, it could be a guestbook entry, an order form for a selection of books, or a quiz on some subject. A form must have a submit button and should also have a reset button. Use a reasonable variety of ways of gathering data. In fact, please use at least 3 of:
  4. Also include submit and reset buttons
  5. Test the working of your form by specifying as action:
  6. Tell me what you did, by filling out this form, so that I can find your form easily, and you can tell me anything you want about it, or your pages.
Your Linux code (Osiris usernae)
Name (only) of the page where your form is:
What you want to tell me about your form or what you did new this week:

Please note: for a "select multiple" php has a problem in that it will only remember the last selection. To solve it, if the action is .php, name the select with brackets, thus: flavours[] rather than flavours. This lets PHP know you want an array of values for flavours.

This comment also applies to a set of checkboxes with the same name (but also needing differing values). However, it might make more sense to just give the checkboxes differing names.

For a summary of form elements, please refer the the HTML Quick Guide included in the course pack, my form notes, or online references.

In your form, please include at least 3 of these element types:

Things to check for:

(many antique general instructions deleted here)

Prepared by Lin Jensen