236170316030
Dinesh Kumar
Information Technology
242
Government Polytechnic
DTE’s Vision:
To provide globally competitive technical education;
Remove geographical imbalances and inconsistencies;
Develop student friendly resources with a special focus on girls’ education and support to
weaker sections;
Develop programs relevant to industry and create a vibrant pool of technical professionals.
Institute’s Vision:
To be a leading technical institute that provides transformative education to learners for
achieving competency as per the needs of industry and society, thus contributing to nation
building.
Institute’s Mission:
To provide a conducive learning environment to nurture learners.
To act as a catalyst for achieving academic excellence by bringing stake holders on same
platform.
To be committed towards continuous improvement and enrichment of learners by a holistic
approach to education so as to enable them to be successful individuals and responsible
citizens of India.
Department’s Vision:
To acquire quality Education, Research and Development in the field of Information technology
meeting the global standards and comply with the ever-growing technology
Department’s Mission:
The graduates of our department will be efficient in technical and ethical responsibilities to
become globally recognised by pursuing opportunities for higher studies and real time problem
solving.
Students will be competent by learning the principals of Information technology that can match
national and international standards.
Dinesh Kumar.
236170316030
Government Polytechnic (617)
2024-2025
GP Ahmedabad
236170316030
Dinesh Kumar Even
12
19
22
26
29
31
33
37
39
42
44
45
Practical No. 1 : Environment setup, Configuration and Syntax
A. Install and configure PHP, Apache Web Server and database server
using XAMPP.
B. Write a PHP script to display Welcome message.
A. Install and configure PHP, Apache Web Server and database server
using XAMPP.
1. Download XAMPP: Go to the official Apache Friends website
([Link] and download the
XAMPP installer for your operating system (Windows, Linux, or
macOS).
2. Run the Installer: Execute the downloaded installer. You'll be presented
with a setup wizard.
12 | Page
3. Select Components: In the "Select Components" step, ensure that at least
"Apache," "MySQL," and "PHP" are selected. You can also choose other
components like phpMyAdmin (for database management) if you wish.
4. Installation Directory: Choose an installation directory. The default is
usually C:\xampp (on Windows).
13 | Page
5. Complete Installation: Continue through the wizard and complete the
installation.
14 | Page
6. Start XAMPP Control Panel: Once installed, open the XAMPP Control
Panel. You should find it in your Start Menu (Windows) or Applications
folder (macOS/Linux).
7. Start Apache and MySQL: In the XAMPP Control Panel, click the "Start"
buttons next to "Apache" and "MySQL." If they start successfully, you'll
see green indicators.
15 | Page
8. Testing Apache: Open your web browser and go to [Link] or
[Link] If XAMPP is installed correctly, you should see the
XAMPP welcome page.
16 | Page
9. Testing PHP: Create a new file named [Link] inside the htdocs folder
within your XAMPP installation directory (e.g., C:\xampp\htdocs). Add
the following PHP code to the file:
• Save the file. Now, in your browser, go to [Link] . This
page displays detailed information about your PHP installation. If you see
this information, PHP is working correctly.
17 | Page
B. Write a PHP script to display Welcome message.
1. Create a PHP File: In the htdocs folder (e.g., C:\xampp\htdocs), create a
new file named [Link] (or any name you prefer with a .php
extension).
2. Write the PHP Code: Add the following PHP code to the [Link]
file:
• Now, in your browser, go to [Link] .
Assessment-Rubrics
18 | Page
Practical No. 2 : Variables, Constant and Operators
A. Write a PHP script to demonstrate use of global, local, static variables
and constant.
B. Write a PHP script to demonstrate arithmetic operators, comparison
operator, and logical operator.
C. Write a PHP program to swap two numbers with and without using
third variable
A. Write a PHP script to demonstrate use of global, local, static variables
and constant.
• Source code :
• Input-Output :
19 | Page
B. Write a PHP script to demonstrate arithmetic operators, comparison
operator, and logical operator.
• Source code :
• Input-Output:
20 | Page
C. Write a PHP program to swap two numbers with and without using
third variable
• Source code :
• Input-Output:
Assessment-Rubrics
21 | Page
Practical No. 3 : Conditional Statements
A. Write a PHP script to check the given number is odd or even.
B. Write a PHP script to print student’s grade based on marks of 5
subjects.
C. Create a PHP script to show the month of a year using switch
statement.
A. Write a PHP script to check the given number is odd or even.
• Source code :
• Input-Output :
B. Write a PHP script to print student’s grade based on marks of 5
subjects.
22 | Page
• Source code :
• Input-Output:
23 | Page
C. Create a PHP script to show the month of a year using switch
statement.
• Source code :
• Output:
24 | Page
• Input-Output:
Assessment-Rubrics
25 | Page
Practical No. 4 : Looping Structures
A. Write PHP Script to print Fibonacci series in html tabular format.
B. Write a PHP script to print below number triangle.
C. Write a PHP script to create chess board (tabular structure).
A. Write PHP Script to print Fibonacci series in html tabular format.
• Source code :
26 | Page
• Input-Output:
B. Write a PHP script to print below number triangle.
• Source code:
• Input-Output:
27 | Page
C. Write a PHP script to create chess board (tabular structure).
• Source code:
• Input-Output:
Assessment-Rubrics
28 | Page
Practical No. 5 : Arrays
A. Write PHP Script for addition and multiplication of two 2x2 matrices.
B. Write a PHP Script to count the number of elements in an array without
using built-in function (use numeric and associative arrays).
A. Write PHP Script for addition and multiplication of two 2x2 matrices.
• Source code :
29 | Page
• Input-Output:
B. Write a PHP Script to count the number of elements in an array without
using built-in function (use numeric and associative arrays).
• Source code:
• Input-Output:
Assessment-Rubrics
30 | Page
Practical No. 6 : User defined Functions
A. Write a PHP script to call by reference and call by value.
B. Write a PHP Script for performing function that takes arguments with
default argument and returns value.
C. Write a PHP Script to show the use of variable length argument.
A. Write a PHP script to call by reference and call by value.
• Source code :
• Input-Output:
B. Write a PHP Script for performing function that takes arguments with
default argument and returns value.
• Source code :
31 | Page
• Input-Output:
C. Write a PHP Script to show the use of variable length argument.
• Source code:
• Input-Output:
Assessment-Rubrics
32 | Page
Practical No. 7 : Built-In functions
A. Write PHP script to demonstrate use of various strings handling
function.
B. Write a PHP script to Demonstrate Include() and require() function.
C. Write PHP script to demonstrate Array functions.
D. Write PHP script to demonstrate use of fopen(), fread(), fwrite() and
fclose() File functions.
A. Write PHP script to demonstrate use of various strings handling
function.
• Source code :
• Input-Output:
B. Write a PHP script to Demonstrate Include() and require() function.
33 | Page
• Source code:
• Input-Output:
C. Write PHP script to demonstrate Array functions.
34 | Page
• Source code: • Input-Output:
• Input-Output:
D. Write PHP script to demonstrate use of fopen(), fread(), fwrite() and
fclose() File functions
35 | Page
• Source code:
• Input-Output:
Assessment-Rubrics
36 | Page
Practical No. 8 : Form Handling
A. Create student registration form using text box, check box, radio
button, select, submit button. And display user inserted value in new
PHP page using GET or POST Method.
B. Write a PHP script to explain the concept of $_REQUEST.
A. Create student registration form using text box, check box, radio
button, select, submit button. And display user inserted value in new
PHP page using GET or POST Method.
• Source code :
[Link]
37 | Page
• Input-Output:
B. Write a PHP script to explain the concept of $_REQUEST.
• Source code: • Input-Output:
Assessment-Rubrics
38 | Page
Practical No. 9 : Email and Validation
A. Write PHP script to validate form including name, email using
appropriate functions.
B. Write PHP script for sending plain text email, HTML email and
attachments with email.
A. Write PHP script to validate form including name, email using
appropriate functions.
• Source code :
• Input-Output:
B. Write PHP script for sending plain text email, HTML email and
attachments with email.
39 | Page
• Source code: (Sending Plain Text Email)
• Input-Output:
• Source code: (Sending HTML Email)
• Input-Output:
40 | Page
• Source code: (Sending Attachments With Email)
• Input-Output:
Assessment-Rubrics
41 | Page
Practical No. 10 : Session and Cookies
A. Write a PHP script to demonstrate creating, deleting, updating,
retrieving and passing variable cookie data.
B. Write PHP script to demonstrate passing information using Session.
A. Write a PHP script to demonstrate creating, deleting, updating,
retrieving and passing variable cookie data.
• Source code :
• Input-Output:
B. Write PHP script to demonstrate passing information using Session.
42 | Page
• Source code: (Sending Attachments With Email)
• Input-Output:
Assessment-Rubrics
43 | Page
Practical No. 11 : Error Handling
A. Write a PHP script to demonstrate Error Handling.
A. Write a PHP script to demonstrate Error Handling.
• Source code :
• Input-Output:
Assessment-Rubrics
44 | Page
Practical No. 12 : Database
A. Write a PHP script to connect with database server from your webpage.
B. Create a database with student table and write a PHP script to insert a
record in student table.
C. Write a program to read student records from student table and display
all these information in table format on output screen.
D. Write a PHP script to delete and update a specific record from table.
E. Write a PHP script simple login system that allows user to add a new
username if user doesn’t exist in the database, also create a forgot
password link, to redirect user to set up his new password on
authentication.
A. Write a PHP script to connect with database server from your webpage.
• Source code :
• Input-Output:
B. Create a database with student table and write a PHP script to insert a
record in student table.
• Source code:
45 | Page
• Input-Output:
C. Write a program to read student records from student table and display
all these information in table format on output screen.
• Source code:
• Input-Output:
46 | Page
D. Write a PHP script to delete and update a specific record from table.
• Source code:
47 | Page
• Input-Output:
D. Write a PHP script simple login system that allows user to add a new
username if user doesn’t exist in the database, also create a forgot
password link, to redirect user to set up his new password on
authentication.
• Source code:
48 | Page
• Input-Output:
Assessment-Rubrics
49 | Page