ZiBaT => Peter Levinsky => Programming => exercise

PHP Basic
Simple web pages

Updated : 2016-09-26

Exercise: PHP Basic - simple web Pages

Mission:

To have a fist hand impression of PHPStorm - and create some hello world web sites.

Precondition:

Exercise A: Create a simple index.html page

Open PHPStorm and create a new project

Right click on project and create a html file - named 'index'

In the body write 'hello world'

In project menu on index.html-file right-click -> run (after this first time - you can just use the green arrow to run)

Try the  W3C HTML validator of your page.

 

Exercise B: Create a CSS file for your index.html page

Right click on project and create a stylesheet file - e.g. named 'base'.

e.g. make the background of html-page body orange or green.

Modify

index.html page to use this stylesheet by adding

<link rel="stylesheet" type="text/css" href="base.css" />

In between the start and end 'head-tag'.

run again.

Try Validate your CSS

 

Exercise C: Create a Form

In your index.html file create two forms the first to send a GET-request and the second send a POST-request (for forms see http://www.w3schools.com/html/html_forms.asp)

The Get request should be send to a PHP page called GetPage.php and the Post request should be send to a page called PostPage.php.

 

Exercise D: Create the two PHP pages

In the project create two php-files named GetPage.php and PostPage.php.

In each page write something e.g. "I am Get request" and "I am Post request"

Run your application.

What happen?

If the post request do not work - change the port-number to the one in Xampp-apache server.

See what happen now.

Extra :

Try to do more css.

Try to add text fields to the form (what is the difference between get and post when sending field information over the network?)

Try to read the field in PHP (see http://www.w3schools.com/php/php_forms.asp)