Web Based Application Development Using PHP 120421 1 PDF
Web Based Application Development Using PHP 120421 1 PDF
(22619)
Semester –VI
Maharashtra State
Board of Technical Education, Mumbai
(Autonomous) (ISO 9001 : 2015) (lSO/IEC 27001 : 2013)
MAHARASHTRA STATE
BOARD OF TECHNICAL EDUCATION
Certificate
This is to certify that Mr. / Ms:………………………………...................................
…………………..……………………………………………………… of Institute
………………………………………………………………………………………
Course Outcomes(COs)
a. Develop program using control statement
b. Perform operation based on arrays and graphics
c. Develop programs by applying various object oriented concepts. d. Use form controls with validation t
e. Perform database operations in PHP.
Sr. No.
Title of the Practical
a. Install and configure PHP, web server, MYSQL b. Wr
01 c. Write a simple PHP program using expressions and op
07
Content Page
List of Practicals and Progressive Assessment Sheet
Sr. No.
Practical Outcome
Write a PHP program to demonstrate the use of Decision making control stru
a. If statement
b. If-else statement c. Switch statement
2
Write a PHP program to demonstrate the use of Looping structures using-a) W
b) Do-while statement c) For statement
d) Foreach statement
3
Write a PHP program for creating and manipulating-
a) Indexed array
b) Associative array
c) Multidimensional array
4
Write a simple PHP program to demonstrate use of simple function and parameter
Write a simple PHP program to create PDF document buy using graphics concepts
Sr . N o.
Title of The Pratical
Write a PHP program for sending and receiving plain text message (e-mail).
11
Write a PHP program for sending and receiving plain text message (e-mail).
14
Total Marks
I Practical Significance:
Step1:
Step2:
Click XAMPP for Windows. It's a grey button near the bottom of the page. Depending on
your browser, you may first have to select a save location or verify the download.
Step 4
Click Yes when prompted. This will open the XAMPP setup window. You may have to click OK
on a warning if you have User Account Control (UAC) activated on your computer.
Step 6:
Select aspects of XAMPP to install. Review the list of XAMPP attributes on the left side of
the window; if you see an attribute that you don't want to install as part of XAMPP, uncheck its
box. By default, all attributes are included in your XAMPP installation.
Step 9: Click OK. Doing so confirms your selected folder as your XAMPP installation location.
Step 12:
Begin installing XAMPP. Click Next at the bottom of the window to do so. XAMPP will
begin installing its files into the folder that you selected.
Step 13:
Click Finish when prompted. It's at the bottom of the XAMPP window. Doing so will close
the window and open the XAMPP Control Panel, which is where you'll access your servers.
Step 15:
Click Save. Doing so opens the main Control Panel page.
Step 16: Start XAMPP from its installation point. If you need to open the XAMPP Control
Panel in the future, you can do so by opening the folder in which you installed XAMPP, right-
clicking the orange-and-white xampp-control icon, clicking Run as administrator, and clicking
Yes when prompted. When you do this, you'll see red X marks to the left of each server
type (e.g., "Apache"). Clicking one of these will prompt you to click Yes if you want to
install the server type's software on your computer.
Counter intuitively, double-clicking the xampp_start icon doesn't start XAMPP.
Step 17:
Resolve issues with Apache refusing to run. On some Windows 10 computers, Apache won't
run due to a "blocked port". This can happen for a couple of reasons, but there's a relatively easy
fix: Click Config to the right of the "Apache" heading.
Click Apache (httpd.conf) in the menu.
Scroll down to the "Listen 80" section (you can press Ctrl+F and type in listen 80 to find
it faster).
Replace 80 with any open port (e.g., 81 or 9080).
Press Ctrl+S to save the changes, then exit the text editor.
Restart XAMPP by clicking Quit and then re-opening it in administrator mode from its folder.
Step 18:
Click on Start button of (Apache Server, PHP, and MySql). Now Web server is ready to execute
PHP and MySql program.
Program:
<?php
?>
Operators in PHP
x += y
x -= y
x *= y
x /= y
x %= y
=== Ide
!= No
<> No
!== No
> Gr
< Les
>= Gr
<= Les
<=> Spa
.=
=== Identity
!= Inequalit
Operator Name
?: Ternary
Null coalescing
??
<html>
<body>
<center>
<h1>
<b>
<?php
$x = 10;
$y = 6;
?>
</b>
</h1>
</body>
</html>
Output Screen.
Name of Resources
Sr. no.
Hardware: Computer System
1
Operating System
2
3 Software
2 Software
Any other resource used
3
Note: Below given are few sample questions for reference. Teacher must design more such questions
so as to ensure the achievement of identified CO.
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
XI. Exercise
1. https://www.w3schools.com/php/default.asp
2. https://www.guru99.com/what-is-php-program.html
3. https://www.tutorialspoint.com/php/
4. https://tutorialehtml.com/en/php-tutorial-
introduction/ 5. www.tizag.com/phpT/
6. https://books.goalkicker.com/PHPBook/
7. https://codecourse.com/watch/php-basics
Performance Indicators
Process related ( 35 marks)
1 Logical formation
2 Debugging ability
3 Follow ethical practices
Product related (15 marks)
4 Expected output
5 Timely submission of report
6 Answer to sample questions
Total ( 50 Marks)
Marks obtained
Process Related(35)
Practical No: 02
Write a PHP program to demonstrate the use of Decision making control structures using-
a. If statement
b. If-else statement
c. Switch statement
I Practical Significance:
Controls statements are used to control are used to control the flow of execution of program based
on certain conditions. These are used to cause the flow of execution to advance and branch
based on changes to the state of program.
1. if statement
2. if-else statement
3. If..elseif..else statement
1. if: if statement is simple decision making statement. It is used to decide whether a certain
statement or block of statements will be executed or not. i.e. if a certain condition is true then the
block will be executed otherwise not.
Syntax:
if(condition)
2. if-else statement: The if statement alone tells us that if a condition is true it will execute a
block of statements and if the condition false, else block will be executed.
if( condition)
else
}
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION 18
3. switch statement
The switch statement is used to perform different actions based on different conditions. Use the switch
statement to select one of many blocks of code to be executed.
switch(n)
{
case label1:
//code to be executed if n=label1;
break;
case label2:
//code to be executed if n=label2;
break;
case label3:
//code to be executed if n=label3;
break;
...
default:
//code to be executed if n is different from all
labels; }
Nill
2 Software
Any other resource used
3
X. Program Code: Teacher must assign a separate program statement to group of 3-4 students.
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
Note: Below given are few sample questions for reference. Teacher must design more such questions
so as to ensure the achievement of identified CO.
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
XI. Exercise
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
1. https://www.w3schools.com/php/default.asp
2. https://www.guru99.com/what-is-php-program.html
3. https://www.tutorialspoint.com/php/
4. https://tutorialehtml.com/en/php-tutorial-
introduction/ 5. www.tizag.com/phpT/
6. https://books.goalkicker.com/PHPBook/
7. https://codecourse.com/watch/php-basics
Performance Indicators
Process related ( 35 marks)
1 Logical formation
2 Debugging ability
3 Follow ethical practices
Product related (15 marks)
4 Expected output
5 Timely submission of report
6 Answer to sample questions
Total ( 50 Marks)
Marks obtained
Process Related(35)
I Practical Significance:
Loop is used in programming to repeat a specific block of code until certain condition is
true. Students will be able to use while and do-while loop to replace the repetition of statements.
II Relevant Program Outcomes (POs)
1. While loop
while (condition is true)
{
//code to be executed;
}
2. Do..While loop
do
//code to be executed;
3. For loop
for (init counter; test counter; increment counter)
{
//code to be executed for each iteration;
}
4.
VII. Resources Required
Nill
2 Software
Any other resource used
3
X. Program Code: Teacher must assign a separate program statement to group of 3-4 students.
Write a program to print first 30 even numbers. (Using for, while, do..while)
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
Note: Below given are few sample questions for reference. Teacher must design more such questions
so as to ensure the achievement of identified CO.
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
XI. Exercise
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
1. https://www.w3schools.com/php/default.asp
2. https://www.guru99.com/what-is-php-program.html
3. https://www.tutorialspoint.com/php/
4. https://tutorialehtml.com/en/php-tutorial-
introduction/ 5. www.tizag.com/phpT/
6. https://books.goalkicker.com/PHPBook/
7. https://codecourse.com/watch/php-basics
Performance Indicators
Process related ( 35 marks)
1 Logical formation
2 Debugging ability
3 Follow ethical practices
Product related (15 marks)
4 Expected output
5 Timely submission of report
6 Answer to sample questions
Total ( 50 Marks)
Marks obtained
Process Related(35)
I Practical Significance:
Array in PHP is a type of data structure that allows us to store multiple elements of similar
data types under a single variable thereby saving us the effort of creating a different variable for every
data.
Indexed or Numeric Arrays: An array with a numeric index where values are stored linearly.
Associative Arrays: An array with a string index where instead of linear storage, each value can be
assigned a specific key.
Multidimensional Arrays: An array which contains single or multiple array within it and can
be accessed via multiple indices.
These type of arrays can be used to store any type of elements, but an index is always a number.
By default, the index starts at zero.
$cars = array(“Volvo”,”BMW”,”Toyota”);
OR
$cars[0] = “Volvo”;
$cars[1] = “BMW”;
$cars[2] = “Toyota”;
The following example creates an indexed array name $cars, assigns three elements to it, and
then prints a text containing the array values:
<?php
$cars= array("Volvo", "BMW", "Toyota");
echo "I like " . $cars[0] . ", " . $cars[1] . " and " . $cars[2] . ".";
?>
<?php
$cars= array("Volvo", "BMW", "Toyota");
$arrlength=count($cars);
for($x= 0;$x<$arrlength;$x++)
{
echo $cars[$x];
echo "<br>";
}
?>
Associative arrays:
Associative arrays are arrays that use named keys that you assign to them.
OR
$total[‘fyif’]= “58”;
$total[‘syif’]= “61”;
$total[‘tyif’]= “46”;
<html>
<body>
<?php
?>
</body>
</html>
To loop through and print all the values of an associative array, you could use a foreach loop,
like this:
<html>
<body>
<?php
echo "<br>";
?>
</body>
</html>
Example:
$student = array
array("xyz",3401,86.45),
array("abc",3402,87.42),
array("pqr",3403,85.43),
);
<body>
<?php
$student = array
array("XYZ",3401,86.45),
array("ABC",3402,87.42),
array("PQR",3403,85.43),
);
?>
</body>
</html>
We can also put a for loop inside another for loop to get the elements of the $student
array:
<html>
<body>
<?php
$student = array
array("PQR",3402,87.42),
array("ABC",3403,85.43),
);
echo "<ul>";
echo "<li>".$student[$row][$col]."</li>";
echo "</ul>";
?>
</body>
</html>
Nill
2 Software
Any other resource used
3
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
Note: Below given are few sample questions for reference. Teacher must design more such questions
so as to ensure the achievement of identified CO.
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
……………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
XI. Exercise
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION 40
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
1. https://www.w3schools.com/php/default.asp
2. https://www.guru99.com/what-is-php-program.html
3. https://www.tutorialspoint.com/php/
4. https://tutorialehtml.com/en/php-tutorial-
introduction/ 5. www.tizag.com/phpT/
6. https://books.goalkicker.com/PHPBook/
7. https://codecourse.com/watch/php-basics
XIII. Assessment Scheme
Performance Indicators
Process related ( 35 marks)
1 Logical formation
2 Debugging ability
3 Follow ethical practices
Product related (15 marks)
4 Expected output
5 Timely submission of report
6 Answer to sample questions
Total ( 50 Marks)
Marks obtained
Process Related(35)
Practical No: 05
String is a sequence of characters. Students will be able to perform various operations on String
using different methods.
Sr. No.
PHP function
1 strlen()
2 str_word_count()
3 strrev()
4 strpos()
5 str_replace()
6 ucwords()
strtoupper()
7
8 strtolower()
9 str_repeat()
10 strcmp()
Nill
2 Software
Any other resource used
3
X. Program Code: Teacher must assign a separate program statement to group of 3-4 students.
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
Note: Below given are few sample questions for reference. Teacher must design more such questions
so as to ensure the achievement of identified CO.
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
1. https://www.w3schools.com/php/default.asp
2. https://www.guru99.com/what-is-php-program.html
3. https://www.tutorialspoint.com/php/
4. https://tutorialehtml.com/en/php-tutorial-
introduction/ 5. www.tizag.com/phpT/
6. https://books.goalkicker.com/PHPBook/
7. https://codecourse.com/watch/php-basics
Performance Indicators
Process related ( 35 marks)
1 Logical formation
2 Debugging ability
3 Follow ethical practices
Product related (15 marks)
4 Expected output
5 Timely submission of report
6 Answer to sample questions
Total ( 50 Marks)
Marks obtained
Process Related(35)
Practical No: 06
Write a simple PHP program to demonstrate use of simple function and parameterized function.
I Practical Significance:
The real power of PHP comes from its functions. PHP has more than built-in functions, and in
addition you can create your own custom functions. PHP has over 1000 built-in functions that can be
called directly, from within a script, to perform a specific task.
Write a simple PHP program to demonstrate use of simple function and parameterized
function. .
PHP functions are similar to other programming languages. A function is a piece of code
which takes one more input in the form of parameter and does some processing and returns a
value.
They are built-in functions but PHP gives you option to create your own functions as well.
A function will be executed by a call to the function. You may call a function from
anywhere within a page.
Syntax:
function function_name()
{
//body of function.
}
Function Types
1. Simple function
2. Function with parameter
3. Anonymous function.
Example of Simple function:
<html>
<body>
<?php
function writeMessage()
writeMessage();
?>
</body>
</html>
<?php
function addfunc($num1,$num2)
$num=$num1+$num2;
addfunc(50,20);
?>
Anonymous function
Example:
<?php
$a=function() {
};
$a();
?>
Nill
2 Software
Any other resource used
3
X. Program Code: Teacher must assign a separate program statement to group of 3-4 students.
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
Note: Below given are few sample questions for reference. Teacher must design more such questions
so as to ensure the achievement of identified CO.
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
XI. Exercise
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
1. https://www.w3schools.com/php/default.asp
2. https://www.guru99.com/what-is-php-program.html
3. https://www.tutorialspoint.com/php/
4. https://tutorialehtml.com/en/php-tutorial-
introduction/ 5. www.tizag.com/phpT/
6. https://books.goalkicker.com/PHPBook/
7. https://codecourse.com/watch/php-basics
Performance Indicators
Process related ( 35 marks)
1 Logical formation
2 Debugging ability
3 Follow ethical practices
Product related (15 marks)
4 Expected output
5 Timely submission of report
6 Answer to sample questions
Total ( 50 Marks)
Marks obtained
Process Related(35)
Write a simple PHP program to create PDF document buy using graphics concepts
I Practical Significance:
PHP uses a standard code to display the pdf file in web browser. The process of displaying pdf
involves location of the PDF file on the server and it uses various types of headers to define content
composition in form of type, Disposition, Transfer-Encoding etc
Write a simple PHP program to create PDF document buy using graphics concepts
PHP uses a standard code to display the pdf file in web browser. The process of displaying
pdf involves location of the PDF file on the server and it uses various types of headers to
define content composition in form of type, Disposition, Transfer-Encoding etc. PHP passes
the PDF files to read it on the browser. Browser either shows it or download it from local
host server then display pdf.
Note: PHP is not actually reading the PDF file. It does not recognize File as pdf. It only
passes the PDF file to the browser to be read there. If copy the pdf file inside htdocs folder of
XAMPP then it does not need to specify the file path.
FPDF is a PHP class which allows to generate PDF files with pure PHP, that is to say
without using the PDFlib library. F from FPDF stands for Free: you may use it for any kind
of usage and modify it to suit your needs.
FPDF has other advantages: high level functions. Here is a list of its main features:
1. Choice of measure unit, page format and
2. margins Page header and footer management
3. Automatic page break
4. Automatic line break and text
5. justification Image support (JPEG, PNG
6. and GIF) Colors
7. Links
8. TrueType, Type1 and encoding support
9. Page compression
Example:
<?php
require('fpdf.php');
$pdf->AddPage();
$pdf->SetFont('Arial','B',16);
$pdf->Cell(40,10,'Hello World!');
$pdf->Output();
?>
Note: Before executing program download fpdf.php and put into current working directory.
2 Software
Any other resource used
3
X. Program Code: Teacher must assign a separate program statement to group of 3-4 students.
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
Note: Below given are few sample questions for reference. Teacher must design more such questions
so as to ensure the achievement of identified CO.
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
https://www.w3schools.com/php/default.asp
https://www.guru99.com/what-is-php-program.html
https://www.tutorialspoint.com/php/
https://tutorialehtml.com/en/php-tutorial-
introduction/ www.tizag.com/phpT/
https://books.goalkicker.com/PHPBook/
https://codecourse.com/watch/php-basics
XII. Assessment Scheme
Performance Indicators
Process related ( 35 marks)
1 Logical formation
2 Debugging ability
3 Follow ethical practices
Product related (15 marks)
4 Expected output
5 Timely submission of report
6 Answer to sample questions
Total ( 50 Marks)
Marks obtained
Process Related(35)
Inheritance is a mechanism in which one class acquire property of another class. In PHP, The child
class will inherit all the public and protected properties and methods from the parent class. In addition,
it can have its own properties and methods. Constructor is special member function whose task to
initialize objects of class.
Write a simple PHP program to demonstrate use of simple function and parameterized function.
Inheritance:
class Parent
Example:
<?php
class Shape
public $length;
public $width;
public function_construct($length,$width)
$this->length=$length;
$this->width=$width;
}
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION 62
public $height;
$this->length =$length;
$this->width=$width;
$this->height=$height;
echo “This length is {$this->length}, the width is {$this->width}, and the height is
{$this->height}”;
$r=new Rect(10,20,30);
$->intro();
?>
Constructor:
Constructors are special member functions for initialize variables on the newly created
object instances from a class.
When creating a new object, it’s useful to setup certain aspects of the object at the same
time. For example, you might want to set some properties to initial values fetch some
information from a database to populate the object, or register the object in some way.
Constructor hava two types
Default and parameterized constructor.
class emp
private $fname;
private $lname;
$this->fname=$fname;
$this->lname=$lname;
$sid=new emp(“Ramesh”,”Patil”);
$sid->showName();
?>
Nill
2 Software
Any other resource used
3
X. Program Code: Teacher must assign a separate program statement to group of 3-4 students.
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
Note: Below given are few sample questions for reference. Teacher must design more such questions
so as to ensure the achievement of identified CO.
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
……………………………………………………………………………………………………....
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
……………………………………………………………………………………………………....
……………………………………………………………………………………………………....
XI. Exercise
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
8. https://www.w3schools.com/php/default.asp
9. https://www.guru99.com/what-is-php-program.html
10. https://www.tutorialspoint.com/php/
11. https://tutorialehtml.com/en/php-tutorial-
introduction/ 12. www.tizag.com/phpT/
13. https://books.goalkicker.com/PHPBook/
14. https://codecourse.com/watch/php-basics
XIII. Assessment Scheme
Performance Indicators
Process related ( 35 marks)
1 Logical formation
2 Debugging ability
3 Follow ethical practices
Product related (15 marks)
4 Expected output
5 Timely submission of report
6 Answer to sample questions
Total ( 50 Marks)
Marks obtained
Process Related(35)
Practical No. 9:
I Practical Significance:
1.
Develop program on Introspection
2.
Downloaded by Raj Debadwar ([email protected])
lOMoARcPSD|22614209
1. Work
collaboratively in team. 2.
Follow ethical practices.
Introspection
Function
get_class()
get_parent_class()
class_exists()
get_declared_classes()
is_subclass_of()
get_class_vars()
get_object_vars()
method_exists()
get_class_methods()
<? php
class Rectangle
{
var $dim1 = 2;
var $dim2 = 10;
function area()
{
return $this->dim1*$this->dim2;
}
function display ()
{
// any code to display info
}
}
$S = new Rectangle(4,2);
print_r($class_properties);
Array
(
[dim1] => 2
[dim2] => 10
)
Array
(
[dim1] => 4
[dim2] => 2
)
Array
(
[0] => Rectangle
[1] => area
[2] => display
)
Rectangle
Serialization
Serialization of data means converting it into a string of bytes in such a way that you
can produce the original data again from the string via a process as unserialization. After
you have the ability to serialize/unserialize, you can store your serialized string anywhere
and recreate a copy of the data again when needed.
PHP offers two functions, serialize() and unserialize(), which take a value of any type
(except type resource) and encode the value into string form and decode again, respectively.
<!DOCTYPE html>
<html>
<body>
<?php
echo " <h4>Serializing the array</h4></br>";
</body>
</html>
Output:
Serializing the array
a:3:{i:0;s:3:"Red";i:1;s:5:"Green";i:2;s:4:"Blue";}
array(3) { [0]=> string(3) "Red" [1]=> string(5) "Green" [2]=> string(4) "Blue" }
Sr. no.
Name of Resources
Computer System with board specifications
1
2 Software
Any other resource used
3
Note: Below given are few sample questions for reference. Teacher must design more
such questions so as to ensure the achievement of identified CO.
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
XI. Exercise
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
1. https://www.w3schools.com/php/default.asp
2. https://www.guru99.com/what-is-php-program.html
3. https://www.tutorialspoint.com/php/
4. https://tutorialehtml.com/en/php-tutorial-
introduction/ 5. www.tizag.com/phpT/
6. https://books.goalkicker.com/PHPBook/
7. https://codecourse.com/watch/php-basics
Performance Indicators
Process related ( 35 marks)
1 Logical formation
2 Debugging ability
3 Follow ethical practices
Product related (15 marks)
4 Expected output
5 Timely submission of report
6 Answer to sample questions
Total ( 50 Marks)
Marks obtained
Process Related(35)
Practical No: 10
I Practical Significance:
In this practical we will learn how to design a web page using different controls.
Design a web page using a.Text box, b. Radio button, c. Check box, d. Buttons
Relevant Course Outcome(s):
Write a program to design a web page using a.Text box, b. Radio button, c. Check
box, d. Buttons
1. Work collaboratively
in team. 2. Follow
ethical practices
a) Textbox:
A text input field allows a user to enter a single line of text .
Example: For welcome.html file and it has a text field and submit button.
<html>
<body>
<form action=”welcome.php” method=”get”>
<input type=”text” name=”user”/>
<input type=”submit” value=”Submit” />
</form>
</body>
</html>
b) Radio button:
Radio buttons let a user select only one of a limited number of
choices: Example:
<input type="radio" id="male" name="gender" value="male">
<label for="male">Male</label><br>
<input type="radio" id="female" name="gender" value="female">
<label for="female">Female</label><br>
<input type="radio" id="other" name="gender" value="other">
<label for="other">Other</label>
c) Check box:
<input type="checkbox" id="vehicle1" name="vehicle1" value="Bike">
<label for="vehicle1"> I have a bike</label><br>
<input type="checkbox" id="vehicle2" name="vehicle2" value="Car">
<label for="vehicle2"> I have a car</label><br>
<input type="checkbox" id="vehicle3" name="vehicle3" value="Boat">
<label for="vehicle3"> I have a boat</label><br>
d) Buttons :
<!DOCTYPE html>
<html>
<title>W3.CSS</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
2 Software
Any other resource used
3
1. Write a program to design a registration form using textbox, radio button, checkbox
and button.
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
Note: Below given are few sample questions for reference. Teacher must design
more such questions so as to ensure the achievement of identified CO.
1. Write a use and syntax of following
controls: a. Textbox b. Radio button
c. Check box d. Buttons
(Space for Answer)
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
XII.Exercise
1. Develop web page and do validation using control text box, radio button, check box
and button.
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
……………………………………………………………………………………………
………………………………………………………………………………………………
……………………………………………………………………………………………………
…………………………………………………………………………………………………
1. https://www.w3schools.com/php/default.asp
2. https://www.guru99.com/what-is-php-program.html
3. https://www.tutorialspoint.com/php/
4. https://tutorialehtml.com/en/php-tutorial-
introduction/ 5. www.tizag.com/phpT/
6. https://books.goalkicker.com/PHPBook/
7. https://codecourse.com/watch/php-basics
Performance Indicators
Process related ( 35 marks)
1 Logical formation
2 Debugging ability
3 Follow ethical practices
Product related (15 marks)
4 Expected output
5 Timely submission of report
6 Answer to sample questions
Total ( 50 Marks)
Marks obtained
Process Related(35)
111l
Practical No: 11
Design a web page using following form controls:
a. List box, b. Combo box, c. Hidden field box
V Practical Significance:
In this practical we will learn how to design a web page using different controls.
Design a web page using a.List box, b. Combo box, c. Hidden field box
Relevant Course Outcome(s):
Write a program to design a web page using a.List box, b. Combo box, c. Hidden field box
1. Work collaboratively
in team. 2. Follow
ethical practices
a) List box:
A text input field allows a user to enter a single line of text.
Example: For welcome.html file and it has a text field and submit button.
<html>
<head>
<title>List Box</title>
</head>
<body>
<form action="" method="post">
<select name="foods[]" size="3">
<option value="Tomatoes">Tomatoes</option>
<option value="Cucumbers">Cucumbers</option>
<option value="Celery">Celery</option>
</select><br>
<input type="submit" name="submit" value="Submit"/>
</form>
<?php
$c= $_POST['foods'];
if(isset($c))
{
echo 'You have chosen ';
foreach($c as $key => $value)
{
echo $value;
}
}
else
{
echo "You haven't selected any
foods"; }
?>
</body>
</html>
X. Resources used:
2 Software
Any other resource used
3
1. Write a program to design a form using list box, combo box and Hidden field box.
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
…………………………………………………………………………………………………
………………………………………………………………………………………………
Note: Below given are few sample questions for reference. Teacher must design
more such questions so as to ensure the achievement of identified CO.
a. Write a use and syntax of following
controls: b. List box b. Hidden field box
c. Combo box
( Space for Answer)
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
XIV. Exercise
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
b. https://www.w3schools.com/php/default.asp
c. https://www.guru99.com/what-is-php-program.html
d. https://www.tutorialspoint.com/php/
e. https://tutorialehtml.com/en/php-tutorial-
introduction/ f. www.tizag.com/phpT/
g. https://books.goalkicker.com/PHPBook/
h. https://codecourse.com/watch/php-basics
Performance Indicators
Process related ( 35 marks)
1 Logical formation
2 Debugging ability
3 Follow ethical practices
Product related (15 marks)
4 Expected output
5 Timely submission of report
6 Answer to sample questions
Total ( 50 Marks)
Marks obtained
Process Related(35)
I Practical Significance:
Form validation is required to prevent web form abuse by malicious users. Improper
validation of form data is one of the main causes of security vulnerabilities. PHP
provides some inbuilt function using these functions that input data can be validated.
PHP provides some inbuilt function, using these functions that input data can be validated.
empty() function will ensure that text field is not blank it is with some data,
function accepts a variable as an argument and returns. It TRUE when the text field
have filled with some data otherwise it return FALSE.
is_numeric() function will ensure that data entered in a text field is a numeric
value, the function accepts a variable as an argument and returns TRUE when the
text field is submitted with numeric value otherwise it return FALSE.
preg_match() function is specifically used to performed validation for entering
text in the text field, function accepts a “regular expression” argument and a variable as
an argument which has to be in specific pattern. Typically it is for validating email, IP
address and Pin code information in a form.
Example:
A php page fromvalidation.php is having three text field name, mobile number and email
from user, on clicking submit button a data will be submitted to PHP script validate.php on the
server, which will perform three different validation on these three text fields, it will check
that name should not be blank, mobile number should be in numeric form and the email is
validated with an email pattern.
Formvalidation.php
<html>
<body>
<form method="post" action="validdata.php">
<center>
<br><br>Enter Name <input type="text" name="sname">
<br><br>Mobile Number <input type="text" name="mobileno"
maxlength=10> <br><br>Email id <input type="text" name="email">
<br><br><input type="submit" name="submit"
value="Submit"> </center>
</form>
</body>
</html>
validate.php
<?php
$msg=0;
if($_SERVER['REQUEST_METHOD']=="POST")
{
if(empty($_POST['sname'] ))
{
echo "<br>Name can't be blank";
$msg=1;
} if(!
is_numeric($_POST['mobileno'])) {
echo "<br>Enter valid Mobile Number";
$msg=1;
}
if(!preg_match($pattern,$_POST['email']))
{
echo "<br>Enter valid Email id";
$msg=1;
}
if($msg==0)
{
echo "Data has been recorded successfully";
}
}?
>
2 Software
Any other resource used
3
X. Program Code: Teacher must assign a separate program statement to group of 3-4
students.
Write a simple PHP program to check that emails are valid.
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
Enlist and explain different method provided by php for web page validation.
Performance Indicators
Process related ( 35 marks)
1 Logical formation
2 Debugging ability
3 Follow ethical practices
Product related (15 marks)
4 Expected output
5 Timely submission of report
6 Answer to sample questions
Total ( 50 Marks)
Marks obtained
Process Related(35)
I Practical Significance:
1. Work collaboratively
in team. 2. Follow
ethical practices
A cookie is a small file with the maximum size of 4KB that the web server
stores on the client computer. They are typically used to keeping track of
information such as a username that the site can retrieve to personalize the
page when the user visits the website next time.
Syntax:
setcookie(name, value, expire, path, domain, secure);
<?php
$cookie_name = "Teacher";
$cookie_value = "Kimaya";
setcookie($cookie_name, $cookie_value, time() + (86400 * 30), "/"); // 86400 = 1
day ?>
<html>
<body>
<?php
if (!isset($_COOKIE[$cookie_name]))
{
echo "Cookie named '" . $cookie_name . "' is not set!";
}
Else
{
echo "Cookie '" . $cookie_name . "' is set! <br>";
echo "Value is: " . $_COOKIE[$cookie_name];
}
?>
</body>
</html>
Output:
Cookie ' Teacher ' is set!
Value is: Kimaya
b. Session in PHP
A session is a way to store information (in variables) to be used across multiple
pages. Unlike a cookie, the information is not stored on the users computer.
Session variables are set with the PHP global variable: $_SESSION.
Now, let's create a new page called "demo_session1.php". In this page, we start a
new PHP session and set some session variables:
<?php
// Start the session
session_start();
?> <!
DOCTYPE html>
<html>
<body>
<?php
// Set session variables
$_SESSION["favcolor"] =
"green"; $_SESSION["favanimal"]
= "cat"; echo "Session variables
are set."; ?>
</body>
</html>
Output:
Session variables are set.
2 Software
Any other resource Used
3
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
…………….………………………………………………………………………………
……………………………………………………………………………………………..
X Result ( Output of code )
…………………………………………………………………………………………….
……………………………………………………………………………………………
……………………………………………………………………………………………
…………………………………………………………………………………………..
……………………………………………………………………………………………
…………………………………………………………………………………………..
Note: Below given are few sample questions for reference. Teacher
must design more such questions so as to ensure the achievement of
identified CO.
a. Define cookie.
b. Define session.
c. Write difference between cookie and session .
( Space for Answer)
……………………………………………………………………………………………
…………………………………………………………………………………………….
……………………………………………………………………………………………
……………………………………………………………………………………………
……………………………………………………………………………………………
…………………………………………………………………………………………..
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
……………………………………………………………………………………………...
……………………………………………………………………………………………..
XI Exercise
………………………………………………………………………………
………………………………………………………………………………
………………………………………………………………………………
………………………………………………………………………………………….
……………………………………………………………………………………………
……………………………………………………………………………………………
……………………………………………………………………………………………
………………………………………………………………………………...
…………………………………………………………………………………………….
…………………………………………………………………………………………….
……………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
1. https://www.w3schools.com/php/default.asp
2. https://www.guru99.com/what-is-php-program.html
3. https://www.tutorialspoint.com/php/
4. https://tutorialehtml.com/en/php-tutorial-
introduction/ 5. www.tizag.com/phpT/
6. https://books.goalkicker.com/PHPBook/
7. https://codecourse.com/watch/php-basics
Performance Indicators
Process related ( 35 marks)
1 Logical formation
2 Debugging ability
3 Follow ethical practices
Product related (15 marks)
4 Expected output
5 Timely submission of report
6 Answer to sample questions
Total ( 50 Marks)
Marks obtained
Process Related(35)
Practical No: 14
Write a PHP program for sending and receiving plain text message (e-mail).
I Practical Significance:
1. Work
collaboratively in team. 2.
Follow ethical practices.
PHP mail:
PHP mail() is an inbuilt PHP function which is used to send emails from PHP scripts.
Syntax:
mail (to,subject,message,headers,parameters)
This mail() function accepts five parameters as follows and (the last two are optional).
Parameters
To
subject
message
headers
parameters
<html>
<head>
<title> Email using PHP</title>
</head>
<body>
<?php
$to=”[email protected]”;
$subject=”Test mail”;
$message=”This is HTML message”;
$header=”From: [email protected]”;
$header .= “Cc:[email protected]”;
$retvalue=mail($to,$subject,$message,$header);
If($retvalue == true)
{
Echo “ Message sent successfully”;
}
Else
{
Echo “ Message could not be sent”;
}
?>
</body>
</html>
2 Software
3 Any other resource used
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
Note: Below given are few sample questions for reference. Teacher must design more such
questions so as to ensure the achievement of identified CO.
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
XI. Exercise
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
1. https://www.w3schools.com/php/default.asp
2. https://www.guru99.com/what-is-php-program.html
3. https://www.tutorialspoint.com/php/
4. https://tutorialehtml.com/en/php-tutorial-
introduction/ 5. www.tizag.com/phpT/
6. https://books.goalkicker.com/PHPBook/
7. https://codecourse.com/watch/php-basics
Performance Indicators
Process related ( 35 marks)
1 Logical formation
2 Debugging ability
3 Follow ethical practices
Product related (15 marks)
4 Expected output
5 Timely submission of report
6 Answer to sample questions
Total ( 50 Marks)
Marks obtained
Process Related(35)
Practical No: 15
I Practical Significance:
In PHP using MYSQL data can be enter into database . Also we can retrieve and present
data from database.
II Relevant Program Outcomes (POs)
After a database and a table have been created, we can start adding data in them.
<?php
$servername =
"localhost"; $username
= "username";
$password = "password";
$dbname = "myDB";
// Create connection
$conn = new mysqli_connect($servername, $username, $password,
$dbname); // Check connection
if (!
$conn) {
if (mysqli_query($conn,
$sql)) {
echo "New record
inserted successfully"; } else {
echo "could not insert record: " .
mysqli_error ($conn); }
Mysqli_close ($conn
); ?>
The SELECT statement is used to select data from one or more tables:
The following example selects the id, firstname and lastname columns from the MyGuests table and displays
it on the page:
<?php
$servername =
"localhost"; $username
= "username";
$password = "password";
$dbname = "myDB";
// Create connection
$conn = new mysqli_connect ($servername, $username, $password,
$dbname); // Check connection
if (!
$conn) {
die ("Connection failed: " .
mysqli_connect_error ( )); }
if (mysqli_num_rows($result) > 0)
{ // output data of each row
while ($row =
mysqli_fetch_assoc($result)) {
echo "id: " . $row["id"] . " . Name: " . $row["firstname"]. " " .
$row["lastname"]. "<br>"; }
} else
{
echo
"0 results"; }
Mysqli_close ($conn
); ?>
VII. Resources Required
Name of Resources
Sr. no.
Hardware: Computer System
1
Operating System
2
3 Software
2 Software
3 Any other resource used
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
Note: Below given are few sample questions for reference. Teacher must design more such
questions so as to ensure the achievement of identified CO.
1. What is MYSQL? How it is used in
PHP? 2. How to create database in
MYSQL?
3. Name to functions of PHP to connect MYSQL
database. 4. Explain mysqli_connect () function.
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
XII.Exercise
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
1. https://www.w3schools.com/php/default.asp
2. https://www.guru99.com/what-is-php-program.html
3. https://www.tutorialspoint.com/php/
4. https://tutorialehtml.com/en/php-tutorial-
introduction/ 5. www.tizag.com/phpT/
6. https://books.goalkicker.com/PHPBook/
7. https://codecourse.com/watch/php-basics
Performance Indicators
Process related ( 35 marks)
1 Logical formation
2 Debugging ability
3 Follow ethical practices
Product related (15 marks)
4 Expected output
5 Timely submission of report
6 Answer to sample questions
Total ( 50 Marks)
Marks obtained
Process Related(35)
Practical No: 16
I Practical Significance:
The update keyword is basically used to modify or edit the existing records in the database table. It
usually need a where clause to find out in which record change is to be done. It is must to specify
the where clause otherwise all records of that table got modify.
Syntax:
UPDATE table_name SET column1=value1,column2=value2... WHERE column = value
Emp_id
<?php
//connect database
$con=mysqli_connect ("localhost","root","","Employee")
; If(!$con)
{
die(‘error in connection’.mysqli_error());
}
//select the database
mysqli_select_db(“mydb”,$con);
Emp_id
2
3
Name of Resources
Sr. no.
Hardware: Computer System
1
Operating System
2
3 Software
VIII. Resources used:
Sr. no.
Name of Resources
Computer System with board specifications
1
2 Software
3 Any other resource used
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
Note: Below given are few sample questions for reference. Teacher must design more such
questions so as to ensure the achievement of identified CO.
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
XI. Exercise
……………………………………………………………………………………………………..
………………………………………………………………………………………………………
…………………………………………………………………………………………………….
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
………………………………………………………………………………………………………
1. https://www.w3schools.com/php/default.asp
2. https://www.guru99.com/what-is-php-
program.html 3. https://www.tutorialspoint.com/php/
4. https://tutorialehtml.com/en/php-tutorial-
introduction/ 5. www.tizag.com/phpT/
6. https://books.goalkicker.com/PHPBook/
7. https://codecourse.com/watch/php-basics
Performance Indicators
Process related ( 35 marks)
1 Logical formation
2 Debugging ability
3 Follow ethical practices
Product related (15 marks)
4 Expected output
5 Timely submission of report
6 Answer to sample questions
Total ( 50 Marks)
Marks obtained
Process Related(35)