0% found this document useful (0 votes)
155 views

Assignment 1

This document outlines specifications for an assignment with 3 parts (1A, 1B, 1C) involving creating HTML forms and PHP files. Part 1A involves creating a form to accept a two-word place name and using PHP to check for empty/valid input and perform operations on the input. Part 1B involves creating a form to accept two numeric sequences and using PHP to calculate their product. Part 1C involves creating a form to accept a number, generating a random n×n array, and calculating the sum of values excluding the first row and column. The deadline for submission is Thursday, July 28, 2016.

Uploaded by

J
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
155 views

Assignment 1

This document outlines specifications for an assignment with 3 parts (1A, 1B, 1C) involving creating HTML forms and PHP files. Part 1A involves creating a form to accept a two-word place name and using PHP to check for empty/valid input and perform operations on the input. Part 1B involves creating a form to accept two numeric sequences and using PHP to calculate their product. Part 1C involves creating a form to accept a number, generating a random n×n array, and calculating the sum of values excluding the first row and column. The deadline for submission is Thursday, July 28, 2016.

Uploaded by

J
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

COM427

ASSIGNMENT 1 -- Resit
15% contribution to final mark
Deadline: 11:00 Thursday 28 July 2016
Submission: School Office 16G24
Specifications:

1A.
Create an html file with a form containing the following objects whose values are posted to and
received in a backend php file when the Submit button is pressed.
HTML FILE com1a.html
1. Create an appropriate form.
2. Use a Textbox to enter a place with 2 words (2 words with one space between them, e.g,
Belfast City).
3. Use a Submit button to get to com1a.php page.

PHP FILE com1a.php
Print the following messages on the page once it receives 2 words from com1a.html:
- Check if the input is empty or not (using an if statement along with strlen()). Print empty
input on page if no words input; otherwise,
- Check if the input has 2 words with one space (using strops()/substr()); Print Need 2 words
with one space on the page if not 2 words with a space; otherwise,
- Use substr( ) to print the initials of the placename in uppercase (e.g. for East Ham this would
be EH)
- Use substr( ) to print the second word in the placename (e.g. for East Ham this would be
Ham)
- Use substr( )/strrev() plus a for loop starting with the whole placename to reverse the
placename in one go into two individually reversed names while retaining their initial order
(e.g. reversing East Ham to become tsaE maH)

1B.
Create an html file with a form containing the following objects whose values are posted to and
received in a backend php file when the Submit button is pressed.
HTML FILE com2a.html
1. Create an appropriate form

2. Use TWO input Textboxes to allow entering sequences of numbers in the format of 3,2,4 or
5,4,3,2,1 in each of them
3. You should allow any length of the sequences
4. Use a Submit button to get to com2a.php page.

PHP FILE com2a.php
1. Receive the 2 sequences (e.g, 3,2,4 and 5,4,3,2,1) from com2a.html and print the following
equation on the page (ignore the following background colours):
3*5+3*4+3*3+3*2+3*1+2*5+2*4+2*3+2*2+2*1+4*5+4*4+4*3+4*2+4*1=
2. Do calculation as shown above and print the result, e.g, expected result on the page
3*5+3*4+3*3+3*2+3*1+2*5+2*4+2*3+2*2+2*1+4*5+4*4+4*3+4*2+4*1=135

1C.
Create an html file with a form containing the following objects whose values are posted to and
received in a backend php file when the Submit button is pressed.
HTML FILE com3a.html
5. Create an appropriate form
6. Use ONE input Textbox to allow entering a number
7. You should allow any length of the sequences
8. Use a Submit button to get to com3a.php page.

PHP FILE com3a.php
1. Receive the input number n from com3a.html
2. Generate a 2-D array with (e.g, n rows and n columns)
3. Fill in the array with random values between 1 and 20 and print the array on the page
4. Calculate the sum of all the values without the values in the 1st row and without the values
in 1st column. Print the sum on the page. For example, if we have the following 2-D array, the
sum should be 5+4+8+9=26


1
6
7

2
5
8

3
4
9

You might also like