Bit3202 Internet Programming Virt Varsity
Bit3202 Internet Programming Virt Varsity
BBIT/BIT
VIRTUAL VARSITY
c) Using loop concept write PHP code for the output given below
Number Square
5 25
4 16
3 9
2 4
1 1
Required:
i. Write the code for the form with ALL essential components. (6 Marks)
ii. Write the PHP code to receive the submitted details from the form, compute
gross pay, tax amount & net pay then display the computed values.
(8 Marks)
a) What are comments? Explain two major types of comments supported by PHP.
Use examples (5 Marks)
b) Consider a web form for creating new system users. The form consists of the
following fields: First Name, Last Names, username and password.
Required;
i. Write PHP code for the form with ALL essential components to make the
form functional. (5 Marks)
ii. Write the PHP code for receiving and inserting new user details on the
table Users. The user should be informed that the user has been created
or not. (5 Marks)
c) Write a user defined function to calculate the workers’ pay. The function accepts
two arguments representing hours worked and pay per hour. (6 Marks)
d) Using switch case control structure, write a program requests user to input a
number in web form then return a day equivalent to that number as follows:
(8 Marks)
Number Day
1 Monday
2 Tuesday
3 Wednesday
4 Thursday
5 Friday
6 Saturday
7 Sunday
a) Differentiate between client side and server side form validation. (4 Marks)
b) Write PHP code to validate web form to ensure that the field cannot be left empty
before submitting the form. (5 Marks)
Table: Customers
CustID Names Address Product OrderValue
C001 Alex Were Nairobi Computers 150,000
C002 Mary Wangui Kisumu Phones 70,000
C003 Ann Mwere Eldoret TVs 56,000
C004 James Wango Nairobi Computers 200,000
C005 Peteron Joel Kisumu Radios 89,000
ii. Write the MySQL statement that retrieves only customers who have ordered for
computers only. (3 Marks)
iii. Write the MySQL statement to delete customers from Kisumu. (3 Marks)
c) Discuss THREE advantages of dynamic web site over static web site.
(6 Marks)
d) (i) Write a PHP form code for a file named booking.php used for hotel booking.
The form consists of the following fields: (4 Marks)
i. Guest Names
ii. Gender
iii. Check in Date
iv. Check out Date
v. Type of Room (choose from Single, double, master)
(ii) Write the PHP code for a file named received.php which receives and prints
out the submitted from booking.php file above. (5 Marks)