WP Lab Manual
WP Lab Manual
College of
Engineering
Opp. Gujarat University, Navrangpura, Ahmedabad -
LAB MANUAL
Branch: Computer Engineering
WEB PROGRAMMING
(3160713)
Faculty Details:
1) Prof. H. K. GEVARIYA
2) Prof. S. R. Modi
3) Prof. P. D. Salot
WEB PROGRAMMING
(3160713)
Certificate
Term: 2022-2023
Sr. Marks
Title Date Page No. Sign
No. (20)
PRACTICAL SET-1(CO1)
1 Demonstrate use of unordered lists, ordered lists
and definition list.
Make the table of given design using HTML.
Practical Rubrics
RB2 Web Page 05 Appropriate & Full Limited Very Less Identification
Design & Identification of the Identification of of the Problem / Very
Development of Problem & the Problem / Less Solution for the
the Web Page Complete Solution Incomplete Problem
for the Problem Solution for the
Problem
RB3 Testing of the 05 Correct Solution as Partially Correct Very less correct
Web Page required Solution for the solution for the problem
Problem
SIGN OF FACULTY
2
(a)
(b)
Design & Develop Resume web page using
3 basic html tags with appropriate CSS style
to display the content effectively.
Create Student registration webpage using
appropriate HTML form object. (Text box,
4 Text area, Dropdown, Radio button, Submit
button, Checkbox etc.)
PRACTICAL SET-2(CO2)
Create HTML Page with JavaScript that
5 prints Factorial number / Fibonacci series.
1. RATIONALE
• The wide spread use of the Internet and WWW by common people has made it compulsion to
provide web-based interface for the applications to access the application from anywhere,
anytime, anyone.
• The subject covers the wide range of web technologies both client side and server side to
provide the exposure to the students to develop Rich Internet Applications using them.
• It covers the basics of WWW, HTML, CSS and client-side scripting with JavaScript, server-
side scripting with PHP and database connectivity using PHP and related technologies.
2. COMPETENCY
The course content should be taught and implemented with the aim to develop required skills
in the students so that they are able to acquire following competency:
Develop GUI based Web application using HTML, CSS, JAVASCRIPT and PHP
with Database Connectivity.
3. COURSE OUTCOMES
CO-1 Use the various HTML tags with appropriate styles to display the various types of contents effectively
CO-2 Develop the dynamic web pages using HTML, CSS and JavaScript applying web design principles to
make pages effective.
CO-3 Develop the server-side PHP scripts using various features for creating
customized web services.
CO-4 Write the server side scripts for designing web-based services with database connectivity.
CO-5 Develop a web application using advanced web programming features including AJAX and JQuery
using concepts of Web API.
AIM 1: Demonstrate use of unordered lists, ordered lists and definition list
Theory:
Unordered lists:
We use unordered lists to group items having no numerical order. When changing the order of list
items, the meaning will not change. To create an unordered list, we use the <ul> tag. This tag comes
in pairs, the content is written between opening <ul> and closing </ul> tags.
Ordered lists
HTML ordered list is used for listing items that are marked with numbers. It starts with
the <ol> tag. This tag comes in pairs, the content is written between opening <ol> and closing
</ol> tags.
Each item in the ordered list starts with opening <li> tag and ends with </li> closing tag.
Definition list
HTML Description list is also a list style which is supported by HTML and XHTML. It is also
known as definition list where entries are listed like a dictionary or encyclopaedia.
The definition list is very appropriate when you want to present glossary, list of terms or other name-
value list.
Program:
Output
Theory:
HTML table tag is used to display data in tabular form (row * column). There can be many columns
in a row.
We can create a table to display data in tabular form, using <table> element, with the help of <tr>,
<td>, and <th> elements.
In Each table, table row is defined by <tr> tag, table header is defined by <th>, and table data is
defined by <td> tags.
Tag Description
<col> It is used with <colgroup> element to specify column properties for each column.
Program:
Output
AIM 3: Design & Develop Resume web page using basic html tags with
appropriate CSS style to display the content effectively.
Theory:
Creating an attractive page will be difficult for those who are not experts in CSS. Without
using CSS, you will not be able to make the web page, more attractive. So in order to make a
web page, we need to have a knowledge of HTML and CSS. In this article, the focus will be
1. Create the structure with HTML. The first thing you have to learn, is HTML, which is
the standard markup language for creating web pages.
2. Style with CSS. The next step is to learn CSS, to set the layout of your web page with
beautiful colors, fonts, and much more.
3. Make it interactive with JavaScript. After studying HTML and CSS, you should learn
JavaScript to create dynamic and interactive web pages for your users.
Program:
Output
button Defines a simple push button, which can be programmed to perform a task on an event.
Program:
Output
[CO2] Develop the dynamic web pages using HTML, CSS and JavaScript applying web
design principles to make pages effective.
AIM 1: Create HTML Page with JavaScript that prints Factorial number /
Fibonacci series.
Theory:
Factorial number
Factorial of number is the product of all positive descending integers. Factorial of n is denoted by n!
For example -
4! = 4 * 3 * 2 * 1 = 24
5! = 5 * 4 * 3 * 2 * 1 = 120
Here, 4! is pronounced as "4 factorial", it is also called "4 bang" or "4 shriek".
we are iterating a loop over the sequence of numbers to get the factorial of a given number. Using
this approach, the consumption of memory is less than the recursive implementation. But the code is
lengthier than the recursive method.
Fibonacci series is a series that generates subsequent series of numbers by the addition of the two
previous numbers. The first two terms of the Fibonacci series are zero and one, respectively. And the
next terms are the addition of the two previous terms.
Program:
Output
AIM 2: Create HTML Page with JavaScript which takes Integer number as
input and tells whether the number is ODD or EVEN using Popup box.
Theory:
Even numbers are those numbers that are exactly divisible by 2.
The remainder operator % gives the remainder when used with a number. For example,
const number = 6;
Hence, when % is used with 2, the number is even if the remainder is zero. Otherwise, the number
is odd.
Program:
Output
Theory:
the Calculator is a portable device used in our daily life to perform various mathematical
functions such as addition, subtraction, multiplication, division, root, etc. However, we have
scientific or sophisticated calculators used to solve complex tasks such as trigonometry
functions, degrees, exponential operators, log functions, hyperbolic functions, square root, and so
on.
Program:
Output
a. If the mouse is over heading, change font color to “red” and if the mouse goes
out of the heading change it to “black”.
b. If button named “red” is clicked, background should change to red and If
button named “green” is clicked, background should change to green.
c. Gives the key code for the key pressed, if key pressed is ‘a’,’e’,’i’,’o’,’u’, the
message should be displayed on pop up box that “vowel is pressed” and
Background color should change to red after releasing the pressed key
Theory:
Common HTML Events
Here is a list of some common HTML events:
Event Description
onmouseout The user moves the mouse away from an HTML element
Event handlers can be used to handle and verify user input, user actions, and browser actions:
Program:
Output
AIM 5: Design a form using HTML and JavaScript that asks the user to enter
his date of birth and on clicking the Calculate Button it calls the function that
calculates how many days are left in your birthday?
Theory:
JavaScript offers some built-in date and time functions, which helps to calculate the age from the
date (Date of Birth). Using these JavaScript methods, you can easily find the age of anyone. For
this, we require a date input from the user and the current system date. We need to track the
following conditions in mind while calculating the difference between them:
o If the current date is less than the date (birthdate) entered by the user, that month will
not be counted as the month is not completed. Otherwise, we will add the number of
month days (30 or 31) to the current date to get the difference between them.
o If the current month is less than the birth month, the current year will not be counted. To
get the month's difference, we will subtract by adding the total number of months (12) to
the current month.
o Finally, we just need to subtract the date, month and year after satisfying the above two
conditions.
Program:
Output
AIM 6: Write a java script program to “Wish a user “at different hours of a
day.
Theory:
In this practical, we will learn how to “welcome” any user according to the time. i.e.- if time is
below 12 then it shows “Good Morning, welcome to our website”. if time is greater than 12 but
less than 17 then it shows "Good Afternoon, welcome to our website". if time is greater than 17
but less than 24 then it shows "Good Evening, welcome to our website".
Program:
Output
o We will create JavaScript functions (one for each input field whose value is to
validate) which check whether a value submitted by user passes the validation.
o It sets the focus to the input field until the user supplies a valid value.
o When the user does so, they may proceed and can supply value to the next available
field.
o The later JavaScript function created is called on the on submit event of the form.
Program:
Output
[CO3] Develop the server-side PHP scripts using various features for creating customized
web services.
AIM 1: Write PHP script to demonstrate use of given date/time functions.
date (), getdate(), setdate(), time(), checkdate().
Theory:
setDate () function is an inbuilt function in PHP which is used to reset the current date of Date Time
object with the given date-time object.
The PHP date () function converts timestamp to a more readable date and time format.
The checkdate () function is a built-in function in PHP which checks the validity of the date passed
in the arguments. It accepts the date in the format mm/dd/yyyy. The function returns a Boolean
value. It returns true if the date is a valid one, else it returns false.
The time () function is used to get the current time as a Unix timestamp
The getdate () function is an inbuilt function in PHP which is used to get date/time information of
the current local date/time.
Program:
Output
1 1
ab 01
234 101
cdef 0101
56789 10101
Theory:
Generally, the pattern program is not helpful in the actual programming scenario, but we can
learn how to use nested loops by practicing this type of program.
It gives us deep idea about how to interact with one or more loops and how to iterate it.
Program:
Output
AIM 3: Write PHP script to demonstrate use of Math functions. abs () &
round(), ceil() & floor(), min() & max(), pow() & sqrt().
Theory:
abs() : This function takes negative value as input and returns the absolute (positive) value of a
integer or float number
round() : This function takes numeric value as argument and returns the next highest integer value
by rounding up value if necessary.
ceil() : This function takes numeric value as argument and returns the next highest integer value by
rounding up value if necessary
floor() : This function takes numeric value as argument and returns the next lowest integer value
(as float) by rounding down value if necessary.
The max() function returns the highest value in an array, or the highest value of several specified
values.
The min() function returns the lowest value in an array, or the lowest value of several specified
values.
The pow() function returns x raised to the power of y
The sqrt() function returns the square root of a number.
Program:
Output
Theory:
The PHP super globals $_GET and $_POST are used to collect form-data. It is very useful to
retrieve all the information which is filled in form by user.
Program:
Output
Parameter Description
expire Optional. Specifies when the cookie expires. The value: time () +86400*30, will set
the cookie to expire in 30 days. If this parameter is omitted or set to 0, the cookie
will expire at the end of the session (when the browser closes). Default is 0
path Optional. Specifies the server path of the cookie. If set to "/", the cookie will be
available within the entire domain. If set to "/php/", the cookie will only be
available within the php directory and all sub-directories of php. The default value
is the current directory that the cookie is being set in
domain Optional. Specifies the domain name of the cookie. To make the cookie available
on all subdomains of example.com, set domain to "example.com". Setting it to
www.example.com will make the cookie only available in the www subdomain
secure Optional. Specifies whether the cookie should only be transmitted over a secure
HTTPS connection. TRUE indicates that the cookie will only be set if a secure
connection exists. Default is FALSE
httponly Optional. If set to TRUE, the cookie will be accessible only through the HTTP
protocol (the cookie will not be accessible by scripting languages). This setting can
help to reduce identity theft through XSS attacks. Default is FALSE
Program:
Output
[CO4] Write the server side scripts for designing web-based services with database
connectivity.
AIM 1: Extend Practical set 3(4) by applying insert operation and display the
student records with update and delete facility.
Theory:
Before we can access data in the MySQL database, we need to be able to connect to the server
connection object.
After a database and a table have been created, we can start adding data in them.
The INSERT INTO statement is used to add new records to a MySQL table:
UPDATE table_name
SET column1=value, column2=value2,...
WHERE some_column=some_value
Program:
Output
AIM 2: The user is first served a login page which takes users name and
password. After submitting the details, the server checks these values against
the data from a database and takes the following decisions
a. If name and password match, serves a welcome page with user's full
name.
b. If name matches and password does not match, then serves password
mismatch page.
c. If name not found in database, serves a registration page where users full
name is asked and on submitting the full name, it stores, the login name,
password and full name in the database (HINT: Use session for storing
the submitted login name and password.)
Theory:
A session is a way to store information (in variables) to be used across multiple pages.
What Is Session??
When you work with an application, you open it, do some changes, and then you close it. This is
much like a Session. The computer knows who you are. It knows when you start the application
and when you end. But on the internet there is one problem: the web server does not know who
you are or what you do, because the HTTP address doesn't maintain state.
Session variables solve this problem by storing user information to be used across multiple pages
(e.g. username, favourite colour, etc.). By default, session variables last until the user closes the
browser.
So; Session variables hold information about one single user, and are available to all pages in
one application.
Session variables are set with the PHP global variable: $_SESSION.
Notice that session variables are not passed individually to each new page, instead they are
retrieved from the session we open at the beginning of each page (session_start()).
Also notice that all session variable values are stored in the global $_SESSION variable.
Program:
Output
AIM 2: Write a program that keeps track of how many times a visitor has loaded
the page.
Theory:
A session mechanism can be used to store page views which increment on each refresh and
show the count on a webpage. A session is user specific and for every user, a separate session
is created along with a separate session variable which is associated with that session.
Using this mechanism, for every user the session variable is set to 1 initially for the first visit.
On consecutive visits, the value of this session variable is incremented and displayed on the
output webpage.
Program:
C.E., L. D. College of Engineering, Ahmedabad-15 51
WEB PROGRAMMING
(3160713)
Output
Theory:
What is Ajax?
Asynchronous JavaScript and XML can be defined as a set of users in building websites and web
applications. Identifying specific purposes in web development applications is the best way to
understand Ajax. Ajax’s main work is to update the content asynchronously means in the user’s
web page whole content need not be reloaded, and only the required field is reloaded. XML is a
markup language means these are coded languages to annotate parts of a web document which
gives web browsers instructions about understanding and displaying the user content.
It combines various programming tools like JavaScript, HTML, DHTML, XML (extensible
markup language), CSS (cascading style sheets), DOM (document object model) and Microsoft
object
What is jQuery?
jQuery is an open-source JavaScript library that simplifies the interactions between an HTML/CSS
document, or more precisely the Document Object Model (DOM), and JavaScript. Elaborating the
terms, it simplifies HTML document traversing and manipulation, browser event handling, DOM
animations, Ajax interactions, and cross-browser JavaScript development
API stands for Application Programming Interface. API is actually some kind of interface
which is having a set of functions. These set of functions will allow programmers to acquire
some specific features or the data of an application.
Web API is an API as the name suggests, it can be accessed over the web using the HTTP
protocol. It is a framework that helps you to create and develop HTTP based RESTFUL
services. The web API can be developed by using different technologies such as java,
ASP.NET, etc.
Program:
Output