/bt2201-php_forms_date

For the BT2201 PHP workshop

Primary LanguagePHP

BT2201 Task PHP Forms

Introduction

Overview

This week we'll start using forms in PHP. I have created two files for you to work in.

Remember that the server will only check if there is PHP code in a file if the file extension is '.php'.

Editing

The quick way...

If you like you can edit files directly in GitHub's web interface. This is a very convenient way of creating and editing the files.

To test your files you should upload them to your web space on bimserver2.com.

The preferred way...

The preferred way of working is to create and edit the files on your own machine.

To get the repository to your own machine you can use GitHub Desktop (which is now available in Application Catalogue!) or link your GitHub account to PHPStorm (there are many more ways but these two are very convenient).

  • You then upload these files to bimserver2 for testing.
  • You commit changes and push the commits to your GitHub account to create a history of the changes over time.
  • You can work on several machines and use commits as a way of keeping the files on different machines up to date.

Task

Below is today's task.

Add a form to the form.php file that asks the visitor of your website for a date they want to know more about, e.g. the date they were born. The contents of the form should then be send to calculation.php. This file should use the date() and mktime() function to determine which day of the week a specific date fell on.

Example: The user enters 5 February 1998 in the form. The website should then show that this was a Thursday.

  • ☞Add the final URL on bimserver2.com to the comment at the top of your files, like we did in the previous week.
  • ☞Give the page(s) a meaningful title (<title></title>).
  • ☞Upload the file(s) to your area on bimserver2.com.

You are welcome to copy and paste HTML from my lecture slides, but the quotes might need changing from opening double quotes (“) and closing double quotes (”) to straight double quotes (").

If you use code from a source other than our class (e.g. from our book) I expect you to add comments to your code that explain how it works. This way you can show that you have written the code yourself and that you understand how the code works.

Commit early, commit often - that way you can go back if you have made a mistake and I can see all the work you have done. There's no problem if you commit and there's a mistake in your file.

Once you are done be sure to commit your changes (that will save them to the repository) and to push them to GitHub (so that I can see the work you have done).

This task is part of your first assignment.

As this task is part of the first assignment you should work individually, not with other students, and shouldn't show the final version of your files to other students, e.g. on the module discussion board.