Lab 4 -- Feb 9

In this lab you will be setting up a very simple web home page and putting some form buttons onto that page.

Set up for a web home page

Everyone (in this class) can set up a homepage for themself on our database server. To do so:
  1. Log into UNIX (any machine will work)
  2. In you home directory create a new directory named public_html This dirctory must be in your home directory, not in a subdirectory. For instance, for me that would be /home/gtowell/public_html. Be sure that the directory is public readable and executable.
  3. Within the public_html directory create a file test.txt and put something in it (random characters are fine)
  4. Test you work: In a browser, navigate to For example, for me that would be If you actually do this for my URL you should see "Hello 383". If you do it for your URL you should see whatever you put into the file test.txt
  5. You are done (with this part). If you cannot get this to work, contact me as it is possible I mis-configured the web server for you.
Having set up your public home directory and tested that it works; now actually create a home page.
  1. In your public_html directory create a file named index.html
  2. Initially put into this file the following contents (whitespace is not significant)
            Your Name
  3. Check that this works. In your browser enter the URL
  4. You should see your name in the browser. (When you do not specify a page, the Apache server will, by default, look for a file named index.html and display its contents. Depending on the Apache configuration, if there is no index.html file, the contents of the directory might be shown.

Add forms

Finally add 4, yes 4, forms to your index.html page by simply copying the following into your page (between <body> and </body>).

To each form of these foorms add at least one element (for instance a text entry box). Each form should have a different type of additional element.
    <form method="post" action="">
    <input type="submit" value="Submit1">
    <form method="get" action="">
    <input type="submit" value="Submit2">
    <form method="post" action="">
    <input type="submit" value="Submit3">
    <form method="get" action="">
    <input type="submit" value="Submit4">
When you hit the button, what you will get (mostly) is just echo the content that was submitted with the form back because I created a web server that does exactly this. (We will get to creating such servers soon.). The echo is dependent of the way you set up your form element and what you entered into your forms.

Experiment with your forms add some more elements to them. Notice what changes in the echo as you change the contents of your form. Notice too that the actual URL changes in the second and fourth forms despite the "action" URL in the forms being identical.

That is it, almost.

What to hand in

Send email to with two pieces of information.
  1. The URL of the page containing your forms
  2. 3 sentences (or so) about the difference between the get and post methods for forms.