meandeviation.com> learn php > getting started

Server-Side Scripting ... getting started

Before actually producing server side scripts there are various things to learn at the 'front end' of the web page. Also there are some exercises to get you ready for producing scripts.

Also look again at my Interfaces tutorial article on the Active Web technology.

raw html

When you produce server-side scripts you will be generating HTML. In order to do this you will need to get used to writing raw HTNL tags. For simple web pages you ought to know how to use the folliowing tags:

Use any HTML book for this.

experiment with web forms

Web forms are one of the main ways in which users interact with server-side scripts.

I have produced some simple server scripts to help you understand how forms work. Use the following two scripts, showform and mailform, to experiment with your own forms.

showform <http://www.meandeviation.com/webform/about-showform.html>
This takes you through basic form elements. the script shows you what is sent to the web server.
mailform <http://www.meandeviation.com/webform/about-mailform.html>
This script mails you the contents of forms completed on the web. You can use this to set up simple questionaires or forms.

link to URLs for dynamic pages

Look at the end of the Excel case study page. It has the following text:

closure - Chapter 6 Models of the user in design, page 240
mode - Chapter 3 The interaction, page 130

These two links are pointing at dynamic URLs, results from the search on the HCI book site.

The first is a simple search on the term "closure":

http://www.comp.lancs.ac.uk/cgi-bin/computing/users/dixa/hcisearch?query=closure

The second is to the fourth page of a search on the term "mode":

http://www.comp.lancs.ac.uk/cgi-bin/computing/users/dixa/hcisearch?query=mode&start=15

The actual HCI book search page has a form with a single text field called "query":

<form method=get action="http://www.hcibook.com/hcibook/search/dosearch.cgi">
   <input type=text size=25 name=query>
   <input type=submit value="search the book!">
</form>
      

When the user fills in the field (e.g. "closure") a URL is sent to the server script (immediately to dosearch,cgi", but this then redirects to "http://www.comp.lancs.ac.uk/cgi-bin/computing/users/dixa/hcisearch"). The URL has "query=closure" added to the end and this is passed to the search script which then generates the page. The script has a second 'parameter' "start=..." which starts the list at the relevant paragrpah (as there are 5 paragraphs per result page "start=15" is the beginning of the fourth page). You can see this at worl if you use the "next 5" link on the search results page.

Try creating pages with links to search results from the book, perhaps to HTML., or to Google results, perhaps server-side scripting.

Look at the list of RAE results list at http://www.meandeviation.com/rae/instlist2.php. Look at the URL at rthe top of the web page when you follow the link for an institution. You can use this URL to make links to, for example, the RAE results for the University of Gloucestershire, like this!

try it by hand

Server-side scripts are oiften used to generate pages from databases. The Computing Department staff page and the RAE results pages are examples. In both there is a summary list (names and email for staff page, institution name for RAE results) each entry of which is linked to a more detailed page.

For example my details page is at:

http://info.comp.lancs.ac.uk/computing/staff/person.php?member_id=034

and the Lancaster RAE results are at:

http://www.meandeviation.com/rae/uoalist.php?hesa=H-0123

Note that the RAE details pages for each institution is itself a list.

Also notice that the staff pages can be sorted in different ways. This is one of the advantages of generating web pages from a database.

In groups or individually try to think of an example like this. For example, you may want to have page for each student, a list of CDs, or possibly a page for each reference in your literature review.

Using Dreamweaver or by hand start to build this. That is, create a page with a summary list and also a few more detailed pages, each in the same overall style and form. Don't worry about producing a details page for everything in your list, this will be what the database and server-side script will do!


http://www.meandeviation.com/tutorials/learnphp/getting-started.html Alan Dix