It Lab 2
It Lab 2
Week Page
Contents
No. No.
#1 To know how to setup PHP 9
#2 To know how to setup Web Server (Apache) 14
#3 Problems based on HTML Programming to create
21
tables/frames/web page
#4 Problems based on HTML/CSS/JAVASCRIPT Programming to
22
create static pages
#5 Problems based to create HTML /XML document , XSLT style
23
sheet & JavaScript script
#6 Problems based on PHP for file handling methods, registration
24
form & type casting
#7 Problems based on PHP Programming to generate bills, file
25
handling methods
#8 Problems based on PHP Programming to create forms, sorting,
26
loops & page view session
#9 Problems based on PHP Programming to perform operations on
27
database/MySQL
2
COURSE TITLE: LABORATORY COURSE COURSE CODE:
CREDIT: PERIODS PER WEEK:
CONTINUOUS ASSESSMENT: Marks EXAMS: Marks
COURSE DESCRIPTION
This course is designed to help students in learning web based technologies.
Approach in this course is to train students for web based languages so that they
will be able to develop a complete web based application.
CONTENT
This course is designed to provide the students the opportunity of learning
HTML, CSS, JavaScript, php and .NET to develop, debug, and execute web based
programs.
OBJECTIVES
To understand the concept of Web Application Development and its
Architecture.
To understand the Essentials of Web Application Development.
To understand and practice web page designing techniques.
To understand the differences between client side & server side
technologies to develop Web Application.
To develop web based applications.
OUTCOMES
Upon successful completion of this course students will be able to:
3
Identify tools and technologies for developing web applications.
Develop web based applications using PHP/.NET, JavaScript, CSS and
other tools.
❒ The students are advised to submit the assignments given in theory and lab
classes timely to their respective Teachers/Instructors online.
❒ Each student shall be assigned a system in their introductory lab. They are
advised to do their work on that system only for the whole semester.
Students should store all their lab activities regularly.
❒ All students are advised to understand course objectives and outcomes and
achieve both during their lab work.
4
APPENDIX–I
PAGE NO.
WEEK
SIGNATURE
NO.
OF THE
PROBLEMS WITH DESCRIPTION TEACHER
WITH DATE
2
1
3
2
2
3
2
3
3
Note: The students should use Header and Footer mentioning their roll no. &
name in footer and page no in header.
5
WEEK #1
Why PHP?
PHP remains the most widespread and popular server-side programming language
on the web. It is installed by most web hosts, has a simple learning curve, close ties
with the MySQL database, and an excellent collection of libraries to cut your
development time. PHP may not be perfect, but it should certainly be considered
for your next web application. Both Yahoo and Facebook use it with great success.
All-in-One packages
There are some excellent all-in-one Windows distributions that contain Apache,
PHP, MySQL and other applications in a single installation file,
e.g. XAMPP (including a Mac version), WampServer and Web.Developer. There
is nothing wrong with using these packages, although manually installing Apache
and PHP will help you learn more about the system and its configuration options.
Manual Installation
Manual installation offers several benefits:
6
backing up, reinstalling, or moving the web server can be achieved in
seconds (see 8 Tips for Surviving PC Failure) and
you have more control over PHP and Apache configuration.
PHP can be installed anywhere on your system, but you will need to change the
paths referenced in the following steps.
extension_dir = "C:/php/ext"
Enable extensions. This will depend on the libraries you want to use, but the
following extensions should be suitable for the majority of applications:
extension=curl
extension=gd2
extension=mbstring
extension=mysql
7
extension=pdo_mysql
extension=xmlrpc
If you want to send emails using the PHP mail() function, enter the details of an
SMTP server (your ISP‟s server should be suitable):
[mail function]
; For Win32 only.
SMTP = mail.myisp.com
smtp_port = 25
Scroll down the System variables list and click on “Path” followed by the “Edit”
button. Click “Edit text” and add ;C:\php to the end of the Variable value line
(remember the semicolon).
8
Now click OK until you‟re out. You might need to reboot at this stage.
9
DirectoryIndex index.php index.html
At the bottom of the file, add the following lines (change the PHP file locations if
necessary):
# PHP5 module
LoadModule php5_module "c:/php/php5apache2_2.dll"
AddType application/x-httpd-php .php
PHPIniDir "C:/php"
Save the configuration file and test it from the command line (Start > Run > cmd):
cd Apache2bin
httpd -t
10
WEEK #2
Since the web server sits between your browser and the requested file, it can
perform processing that is not possible by opening an HTML file directly. For
example, it can parse PHP code which connects to a database and returns data.
You can use your host‟s web server for testing, but uploading will become
tiresome and changes could go live before they had been fully tested. What you
need is a local web server installation.
Why Apache?
In general, I would recommend using the web server software that your web host
uses. Unless you are creating ASP.NET applications on Microsoft IIS, your host is
likely to use Apache: the most widespread and fully-featured web server available.
It is open-source project so it does not cost anything to download or install.
The following instructions describe how to install Apache on Windows. Mac OSX
comes with Apache and PHP, although you might need to enable them. Most
Linux users will have Apache pre-installed or available in the base repositories.
11
All-in-One packages
There are some excellent all-in-one Windows distributions that contain Apache,
PHP, MySQL and other applications in a single installation file,
e.g. XAMPP (including a Mac version), WampServer and WebDeveloper. There is
nothing wrong with using these packages, although manually installing Apache
will help you learn more about the system and its configuration options.
Manual Installation
Manual installation offers several benefits:
Apache listens for requests on TCP/IP port 80. The default installation of Skype
also listens on this port and will cause conflicts. To switch it off, start Skype and
choose Tools Options Advanced Connection. Ensure you untick “Use
port 80 and 443 as alternatives for incoming connections”.
12
Step 2: download the files
If one is using the unofficial Windows binary from Apache Lounge. This version
has performance and stability improvements over the official Apache distribution,
although I am yet to notice a significant difference. However, it is provided as a
manually installable ZIP file from www.apachelounge.com/download/
You should also download and install the Windows C++ runtime from
Microsoft.com. You may have this installed already, but there is no harm installing
it again.
Apache can be installed anywhere on your system, but you will need to change the
configuration file paths accordingly…
13
Step 3: configure Apache
Make the leap into server-side programming with a comprehensive cover of PHP
& MySQL.
Apache is configured with the text file confhttpd.conf contained in the Apache
folder. Open it with your favourite text editor.
14
Note that all file path settings use a „/‟ forward-slash rather than the Windows
backslash. If you installed Apache anywhere other than C:Apache2, now is a good
time to search and replace all references to “c:/Apache2”.
There are several lines you should change for your production environment:
Listen *:80
ServerName localhost:80
AllowOverride All
By default, Apache return files found in its htdocs folder. I would recommend
using a folder on an another drive or partition to make backups and re-installation
easier. For the purposes of this example, we will create a folder called
D:WebPages and change httpd.conf accordingly:
DocumentRoot "D:/WebPages"
<Directory "D:/WebPages">
15
Step 5: test your installation
Your Apache configuration can now be tested. Open a command box (Start > Run
> cmd) and enter:
cd Apache2bin
httpd -t
Correct any httpd.conf configuration errors and retest until none appear.
cd Apache2bin
httpd -k install
Open the Control Panel, Administrative Tools, then Services and double-click
Apache2.2. Set the Startup type to “Automatic” to ensure Apache starts every time
you boot your PC.
Alternatively, set the Startup type to “Manual” and launch Apache whenever you
choose using the command “net start Apache2.2”.
<html>
<head><title>testing Apache</title></head>
<body><p>Apache is working!</p></body>
16
</html>
Ensure Apache has started successfully, open a web browser and enter the
address http://localhost/. If all goes well, your test page should appear.
17
WEEK #3
18
WEEK #4
2# Write an HTML page that contains a selection box with a list of 5 countries,
when the user selects a country, its capital should be printed next to the list;
Add CSS to customize the properties of the font of the capital (color, bold and
font size).
3# Write a java script program to test the first character of a string is uppercase
or not. Write a pattern that matches e-mail addresses.
4# Write a java script program which compute, the average marks of the
following students then this average is used to determine the corresponding
grade.
5# To design the scientific calculator and make event for each button using java
script.
19
WEEK #5
20
WEEK #6
21
WEEK #7
1# Prepare Electricity bill from user input based on a given tariff. Write a PHP
program to input previous reading and present reading and prepare an
electricity bill using the following conditions.
22
WEEK #8
1# Design the personal information form, submit and retrieve the form data using
php $POST, $GET, $REQUEST variable.
2# Write a program In PHP to Sort an array using Bubble Sort function.
3# Write a program in PHP to display Multiplication Table using nested for
loop
4# Write a PHP program to store current date-time in a COOKIE and display
the “Last visited on‟ date-time on the web page upon reopening of the same
page.
5# Write a PHP program to store page views count in SESSION, to increment
the count on each refresh, and to show the count on web page.
23
WEEK #9
1# Write a PHP program to connect to a database and retrieve data from a table
and show the details in a neat format
2# Write a PHP code to insert, delete, select the data from database