CS406 Assignment 2 Solution and Discussion
-
Assignment No. 02
Fall 2019
CS406 – Web Based Database Applications Total Marks: 20Due Date: 05-Dec-2019
Assignment Submission Instructions:
Please read the following instructions carefully before submitting assignment:
It should be clear that your assignment will not get any credit if:o Assignment is submitted after due date.
o Submitted assignment does not open or file is corrupt.
o Assignment is copied (From internet/ to from students).
o You must submit assignment only in .php format, and you must keep all your files in a single folder and zip the folder to upload .zip or .rar file on LMS.Lectures Covered:
Week 4, Week 5 and Week 6 Lectures have been covered.
Objectives:
The purpose of this assignment is to make you familiar with following topics:
• PHP Syntax, Data Types, Variables and Variables scope
• PHP Functions and Controls, Functions, Control Structures, Loops, Arrays
• Embedded PHP, Embedded PHP in HTML 5, Strings in PHP
Assignment Marks: 12+8
Question 1:Write a program in PHP using for loop and embed it in HTML.
- The title “Assignment No 2” should be on the top of the page.
- The border size of the table should be 1.
- There should be 3 Columns and 10 Rows.
- Create 2 arrays, one for Order Quantity and One for Unit price and then multiply Order quantity with Unit price and show it result in 3rd column.
- You will use a single loop to print the values of arrays and the result.
Hint: You can also embed html tags in PHP code.
Sample Out Put:

Question 2:
Write a function (totalWords) in PHP which will receive two strings. After receiving the strings it will find total words in each string individually using built-in function str_word_count() and then it will return the total words of both the strings and then print the total words on the screen.
For example :
String 1= “Virtual University of Pakistan” String 2= “Federal Government University”Total Words = 7
Deadline: Your assignment must be uploaded on or before the given due date. We shall not accept your solution through email after the due date.
-
@zareen said in CS406 Assignment 2 Solution and Discussion:
Write a program in PHP using for loop and embed it in HTML.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login

Assignment No. 1