CS25320: Programming for the Web

PHP:

Dr Angharad Shaw's PHP examples: link

Examples from lecture slides.

Example_0: PHP txt

A sample of PHP premission error.

Example_1: PHP txt

PHP echo and comment.

Example_2: PHP txt

PHP variables, constants and ways to echo them and unset.

Example_3: PHP txt

PHP error report and if statement.

Example_4: PHP txt

PHP ternary conditionals example.

Example_5: PHP txt

PHP switch (case statement).

Example_6: PHP txt

PHP loops (while, do...while, for).

Example_7: PHP txt

PHP numeric array and associative array and ways to print variable information.

Example_8: PHP txt

PHP for, foreach loops and arrays.

Example_9: PHP txt

PHP function with parameter.

Example_10: PHP txt

PHP function with return.

Example_11: PHP txt

PHP function parameters and return example.

Example_12: PHP txt

PHP built-in functions for strings.

Example_13: PHP txt

PHP regular expressions.

Forms and Sessions:

Form: HTML

A simple form with javascript.

Get: HTML PHP txt

Forms input and processing example using PHP and GET.

Post: HTML PHP txt

Forms input and processing example using PHP and POST.

Cookie: PHP txt

Create and remove cookies using PHP and JavaScript.

PHP session: PHP txt ( session1 session2 )

PHP session example.

Database:

Dr Angharad Shaw's database examples: link

Examples from lecture slides.

Database_1: PHP

PHP PostgreSQL, connect to database, fetch data as numeric array and print table.

Database_2: PHP

Fetch data as associative array and print table.

Database_3_4_5: PHP PHP PHP

Different ways of Error handling.

Database_6: PHP

Ordering the table.

Database_7: PHP

SQL WHERE.

Database_8: PHP

Accessing multiple tables.

Database_9: PHP

SELECT.

Database_10: PHP

Other useful functions.

Client Side:

Session 1 Exercise 6: HTML

Basic canvas with JavaScript.

Session 2 Exercise 3_4_5: HTML + CSS and JavaScript (Sprite)

Sprite animation with CSS and javascript.

Exercise:

Exercise 1: link

Exercise on basic PHP, forms and sessions.

Exercise 1 Answer:

Web page 1: HTML
Web page 2: PHP txt
Web page 3: PHP txt

Exercise 2: link

Exercise on PHP, database, CSS and canvas.

Exercise 2 Answer:

Web page 1: HTML
Web page 2: PHP txt
Web page 3: HTML
CSS: CSS

Other:

CS25320 online resources: link

CS25320: Programming for the Web slides and other resoures.

Past writing exam papers: link

Semester One: Module CS250 or CS253 Web Programming.

Vaughan's game example: HTML CSS

A game template. Vaughan may update the game if he is really bored.

Valid XHTML 1.0 Strict Valid CSS!