You are on page 1of 64

KUNAL TAMRAJ HARINKHEDE (1912420306)

A Laboratory Manual for

WebBasedApplicationDevelopmentUsing
PHP
(22619)
Semester– VI
(CO/CW/CM/IF)

Government Polytechnic,Gondia
Fulchur road, Gondia

Maharashtra State Board of Technical Education,


Mumbai
KUNAL TAMRAJ HARINKHEDE (1912420306)

CERTIFICATE

This is to certify that

Mr. KUNAL TAMRAJ HARINKHEDE


Roll-No.62of Sixth Semester of Diploma in Computer Engineering of

Government Polytechnic, Gondia has completed the lab satisfactorily in course

WebBasedApplicationDevelopmentusingPhp(22619)fortheacademicyear

2020-21 as prescribed in thecurriculum.

Place Gondia EnrollmentNo 1912420306

Date Exam SeatNo. 272459

Course Coordinator HOD Principal


[Mr. Zamesh Balhare.] [Mr. J M Meshram.] [Mr. C D Godghate ]

Seal
Instiitute
KUNAL TAMRAJ HARINKHEDE (1912420306)

S. Approx.
Unit
Hrs.
No.
Required
a. Install and configure PHP, web server,ivIYSQL
b. Write n program to print “Welcome toPHI°’.
c. Write a simplePi-11* program using expressions and 1 02*
operators.
2 Write a PHP proSr am tndcmonsiraie the use of Decision
making control structuresusing-
a. If statcmcnt I 02*
b, If-else stniernent
c. Switch statcmcnt
3 Write a PHP program to deiiionstrate the use of Looping
structures using-
a. While statement, b. Do-while statement c,For statement
d. Foreach statement
4 Write a PHP program for creating and manipulating-
a. Indexedarray 02
b. Associativearray
c. Multidimensionalarray
5 a. Write a PHP programto-
i. Calculate length ofstring.
ii, Count the number of words in string -without using
string functions.
›I 2-
b. Write n simple PHP program to demonstrate use ofvarious
built-in gtringfuncLons.
6 Write a simple PHP program to demonstrate use of Simple
function and Parameterized function. ›I 02
7 Write a simple I°HP program to crcate PDF dncument by using
II 02
graphics concepts.
8 Write a PHP program to-
a. Inherit members of super class insubclass.
III 02*
b. Create constructor to initialize object ofclass
--by using object oriented concepts
9 Write a simplG PHP program on Introspection and 02
III
Serialization.
10 Design a web page using following form controls: IV 02*
a. Text box, b. Radio button. c. Check box, d. Burtons
11 Design a web pnge using following form controls: IV O2*
a. 11st box, b. Combo box, c. Hidden field box
12 Develop web page with data validation. IV 02’
13 Write simple PHP program to -
n. Set cookies and read it. IV 02*
b. Demonstrate session Management.
14 Write a simple PHP program for sending and receiving plain iV -
text message (e-mail).
15 Develop a simple application to-
a. Enter data into database V 02*
b, Retrieve and present data from database.
16 Develop a simple application to Updnte, Delete table datn V 02*
database.
Total 32
KUNAL TAMRAJ HARINKHEDE (1912420306)

Practical No. 01:


a. Install and configure php, web server,MYSQL.
b. Write a program to print "Welcome to Php".
c. Write a simple php program using expression andoperators.

I. Relevant ProgramOutcomes(POs)
 Basic Knowledge: Apply knowledge of basic mathematics, sciences and basic engg
to solve the broad based computer enggproblem.
 Discipline Knowledge: Apply computer engg discipline – specific knowledge to
solve core computer engg relatedproblems.
 Experiments and practice: plan to perform experiments and practices to use the
results to solve broad based computer enggproblems.
 Engineering tools: Apply relevant computer technologies and tools with an
understanding of thelimitations.
 Individual and team work: function effectively as a loader and team member in
diverse/ multidisciplinaryteams.
 Communication: communicate effectively in oral and writtenform.
 Life-long learning: engage in independent and life-long learning activities in the
context of technological changes in the computer engg field and alliedindustry.

II. Relevant Affective Domain relatedOutcome(s)


1. Follow safetypractices.
2. Practice goodhousekeeping.
3. Work as a leader/ a teammember.
4. Follow standard configurationprocedures.
5. Follow ethicalpractices.

III. Course OutcomesAddressed


a) Develop program using controlstatement.
b) Perform operations based on arrays andgraphics.
c) Develop programs by applying various object orientedconcepts.
d) Use form controls with validation to collect user'sinput.
e) Perform database operations inPHP.

IV. Precautions
1. Handle computer systemcarefully.
2. Note down the exact output for eachcase.
KUNAL TAMRAJ HARINKHEDE (1912420306)

V. Additional Resourcesrequired

Sr. Name of Specification Quantity Remarks


No. resource
/material
1 Hardware Approx. Windows 10 Intel i5, As per
Computer System 4GB RAM, 1TB HDD Batch For All
Size Practical’s
2 Software/ Website XAMPP Web Server, Notepad+ 1
+ of PHP

III. Result (Output ofprocedure)


a. Install and configure php, web server,mysql

Steps to install XAMPP on Windows:

In the web browser, visit Apache Friends and download XAMPP installer.

During the installation process, select the required components like MySQL, FileZilla ftp
server, PHP, phpMyAdmin or leave the default options and click the Next button.

Uncheck the Learn more about bitnami option and click Next button.
Choosetherootdirectorypathtosetupthehtdocsfolderforourapplications.Forexample ‘C:\
xampp’.

Click the Allow access button to allow the XAMPP modules from the Windows firewall.

After the installation process, click the Finish button of the XAMPP Setup wizard.
Now the XAMPP icon is clearly visible on the right side of start menu. Show or Hide can
be set by using the control panel by clicking on the icon.
KUNAL TAMRAJ HARINKHEDE (1912420306)

To start Apache and MySql, just click on the Start button on the control panel.

Note:SupposeApacheisnotstarting,itmeanssomeotherserviceisrunningatport80.In this
case, stop the other service temporarily and restartit.

Making server request: Open your web browser and check whether the XAMPP service
has properly installed or not. Type in the URL: http://localhost. If you are able to see the
default page for XAMPP, you have successfully installed your XAMPP Server.

To Check if PHP is Working: All the website realted files are organized in a folder called
htdocs and then run index.php file by using http://localhost/index.php or http://localhost.

Note: For every new website or application, its always better to create a different folder
inside htdocs, to keep it organized and avoid confusion.

For example, if we create a folder geeksforgeeks and then create a file nameed as
‘helloWorld.php’.

All the contents related to it are put inside the folder ‘geeksforgeeks’. So the root ‘URL’ of the
websitewillbe‘http://localhost/geeksforgeeks/’.Soanyhomepageisaccessedbytypingtheroot URL
in the browser. To see the output, just type‘http://localhost/geeksforgeeks/helloWorld.php’.

Generally web servers look for index file (landing page) namely index.html or
index.phpintherootofthewebsitefolder.Goto/xampp/htdocs/folderandcreateafilewith.php
extension (test.php) and type or copy the below code and saveit.
KUNAL TAMRAJ HARINKHEDE (1912420306)

<?
phpphpi
nfo();

Now open your browser and go to “http://localhost/test.php” if you see the


page same as below then PHP has successfully installed.

Note: In XAMPP, the configuration files of Apache, MySQL, PHP are located in C:\Program Files\
xampp. For any configuration file changes, you need to restart Apache and MySQL.

b. WRITE A PROGRAM TO PRINT "WELCOME TOPHP".

<?php
echo"Welcome to Php";
?>
Output
KUNAL TAMRAJ HARINKHEDE (1912420306)

File created on localhost , written program

c. Write a simple php program using expression andoperators

<?php
Output' $a = 2, $b = 4;
echo$a."\n";
echo$b."\n";
echo"Sum of both values:", $a + $b;
?>
KUNAL TAMRAJ HARINKHEDE (1912420306)

VI. Conclusion:
Successfully Installed XAMPP Web Server on desktop and executed first program.

VII. AssessmentScheme

S Performance Indicators Weightage in


No. %
1. Completion of given Task. 25%
2. Correctness of given Task. 50%
3. Answer to Sample Questions. 15%
4. Submit Report in Time. 10%
Total 100%

Marks Obtained Dated signature of


Teacher
Process Product Related(15) Total(25)
Related(10)
KUNAL TAMRAJ HARINKHEDE (1912420306)

Practical no 2:
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. Relevant ProgramOutcomes (POs)


 Basic Knowledge: Apply knowledge of basic mathematics, sciences and basic engg
to solve the broad based computer enggproblem.
 Discipline Knowledge: Apply computer engg discipline – specific knowledge to
solve core computer engg relatedproblems.
 Experiments and practice: plan to perform experiments and practices to use the
results to solve broad based computer enggproblems.
 Engineering tools: Apply relevant computer technologies and tools with an
understanding of thelimitations.
 Individual and team work: function effectively as a loader and team member in
diverse/ multidisciplinaryteams.
 Communication: communicate effectively in oral and writtenform.
 Life-long learning: engage in independent and life-long learning activities in the
context of technological changes in the computer engg field and alliedindustry.

II. Relevant Affective Domain relatedOutcome(s)


1. Follow safetypractices.
2. Practice goodhousekeeping.
3. Work as a leader/ a teammember.
4. Follow standard configurationprocedures.
5. Follow ethicalpractices.

III. Course OutcomesAddressed


a) Develop program using controlstatement.
b) Perform operations based on arrays andgraphics.
c) Develop programs by applying various object orientedconcepts.
d) Use form controls with validation to collect user'sinput.
e) Perform database operations inPHP.

IV. Precautions
1. Handle computer systemcarefully.
2. Note down the exact output for eachcase.
KUNAL TAMRAJ HARINKHEDE (1912420306)

V. Additional Resourcesrequired

Sr. Name of Specification Quantity Remarks


No. resource
/material
1 Hardware Approx. Windows 10 Intel i5, As per
Computer System 4GB RAM, 1TB HDD Batch For All
Size Practical’s
2 Software/ Website XAMPP Web Server, Notepad+ 1
+ of PHP

IV. Result (code and output)


a) If statement
<?php
$t = date("H");

if ($t < "20") {
  echo "Have a good day!";
}
?>

b) If-else statement
<?php
$t = date("H");

if ($t < "20") {
  echo "Have a good day!";
} else {
  echo "Have a good night!";
}
?>
KUNAL TAMRAJ HARINKHEDE (1912420306)

c) Switch statement
<?php
$favcolor = "red";

switch ($favcolor) {
  case "red":
    echo "Your favorite color is red!";
    break;
  case "blue":
    echo "Your favorite color is blue!";
    break;
  case "green":
    echo "Your favorite color is green!";
    break;
  default:
    echo "Your favorite color is neither red, blue, nor green!";
}
?>
KUNAL TAMRAJ HARINKHEDE (1912420306)

VII. Conclusion:
The code run successfully and we get required output. Used the decision making control
structures if ,if-else and switch statement.

VIII. AssessmentScheme

S Performance Indicators Weightage in


No. %
1. Completion of given Task. 25%
2. Correctness of given Task. 50%
3. Answer to Sample Questions. 15%
4. Submit Report in Time. 10%
Total 100%

Marks Obtained Dated signature of


Teacher
Process Product Related(15) Total(25)
Related(10)

Practical no 3:
KUNAL TAMRAJ HARINKHEDE (1912420306)

Write php programs to demonstrate the use of looping structures using –


a) While statement
b) Do-while statement
c) For statement
d) Foreach statement
I. Relevant ProgramOutcomes (POs)
 Basic Knowledge: Apply knowledge of basic mathematics, sciences and basic engg
to solve the broad based computer enggproblem.
 Discipline Knowledge: Apply computer engg discipline – specific knowledge to
solve core computer engg relatedproblems.
 Experiments and practice: plan to perform experiments and practices to use the
results to solve broad based computer enggproblems.
 Engineering tools: Apply relevant computer technologies and tools with an
understanding of thelimitations.
 Individual and team work: function effectively as a loader and team member in
diverse/ multidisciplinaryteams.
 Communication: communicate effectively in oral and writtenform.
 Life-long learning: engage in independent and life-long learning activities in the
context of technological changes in the computer engg field and alliedindustry.

II. Relevant Affective Domain relatedOutcome(s)


1. Follow safetypractices.
2. Practice goodhousekeeping.
3. Work as a leader/ a teammember.
4. Follow standard configurationprocedures.
5. Follow ethicalpractices.

III. Course OutcomesAddressed


a) Develop program using controlstatement.
b) Perform operations based on arrays andgraphics.
c) Develop programs by applying various object orientedconcepts.
d) Use form controls with validation to collect user'sinput.
e) Perform database operations inPHP.

IV. Precautions
1. Handle computer systemcarefully.
2. Note down the exact output for eachcase.
KUNAL TAMRAJ HARINKHEDE (1912420306)

V. Additional Resourcesrequired
Sr. Name of resource Specification Quantity Remarks
No. /material
1 Hardware Approx. Windows 10 Intel i5, As per Batch
Computer System 4GB RAM, 1TB HDD Size For All
2 Software/ Website XAMPP Web Server, Notepad++ 1 Practical’s
of PHP

VI. Result (code and output)


a) While statement
<?php
$x = 1;

while($x <= 5) {
  echo "The number is: $x <br>";
  $x++;
}
?>

b) Do-while statement
<?php
$x = 1;

do {
  echo "The number is: $x <br>";
  $x++;
} while ($x <= 5);
?>
KUNAL TAMRAJ HARINKHEDE (1912420306)

c) For statement
<?php
for ($x = 0; $x <= 100; $x+=10) {
  echo "The number is: $x <br>";
}
?>

d) Foreach statement
<?php
$age = array("Peter"=>"35", "Pranav"=>"37", "Joe"=>"43");

foreach($age as $x => $val) {


echo"$x = $val<br>";
}
?>
KUNAL TAMRAJ HARINKHEDE (1912420306)

VII. Conclusion:
The code is run successfully and we get required output. Used the different types of loops
like while, do-while, for, and foreach statement.

VIII. AssessmentScheme
S Performance Indicators Weightage in
No. %
1. Completion of given Task. 25%
2. Correctness of given Task. 50%
3. Answer to Sample Questions. 15%
4. Submit Report in Time. 10%
Total 100%

Marks Obtained Dated signature of


Teacher
Process Product Related(15) Total(25)
Related(10)
KUNAL TAMRAJ HARINKHEDE (1912420306)

Practical no 4:
Write a php program for creating and manipulating –
a) Indexed array
b) Associative array
c) Multidimensional array
I. Relevant ProgramOutcomes (POs)
 Basic Knowledge: Apply knowledge of basic mathematics, sciences and basic engg
to solve the broad based computer enggproblem.
 Discipline Knowledge: Apply computer engg discipline – specific knowledge to
solve core computer engg relatedproblems.
 Experiments and practice: plan to perform experiments and practices to use the
results to solve broad based computer enggproblems.
 Engineering tools: Apply relevant computer technologies and tools with an
understanding of thelimitations.
 Individual and team work: function effectively as a loader and team member in
diverse/ multidisciplinaryteams.
 Communication: communicate effectively in oral and writtenform.
 Life-long learning: engage in independent and life-long learning activities in the
context of technological changes in the computer engg field and alliedindustry.

II. Relevant Affective Domain relatedOutcome(s)


1. Follow safetypractices.
2. Practice goodhousekeeping.
3. Work as a leader/ a teammember.
4. Follow standard configurationprocedures.
5. Follow ethicalpractices.

III. Course OutcomesAddressed


a) Develop program using controlstatement.
b) Perform operations based on arrays andgraphics.
c) Develop programs by applying various object orientedconcepts.
d) Use form controls with validation to collect user'sinput.
e) Perform database operations inPHP.

IV. Precautions
1. Handle computer systemcarefully.
2. Note down the exact output for eachcase.
KUNAL TAMRAJ HARINKHEDE (1912420306)

V. Additional Resourcesrequired

Sr. Name of Specification Quantity Remarks


No. resource
/material
1 Hardware Approx. Windows 10 Intel i5, As per
Computer System 4GB RAM, 1TB HDD Batch For All
Size Practical’s
2 Software/ Website XAMPP Web Server, Notepad+ 1
+ of PHP

VI. Result (code and output)


a) Indexed array
<?php
$cars = array("Volvo", "BMW", "Toyota");
echo "I like " . $cars[0] . ", " . $cars[1] . " and" . $cars[2] . ".";
?>

b) Associative array
<?php
$age = array("Pranav"=>"35", "Ben"=>"37", "Joe"=>"43");
echo "Pranav is " . $age['Pranav'] . " years old.";
?>

c) Multidimensional array
<?php
echo $cars[0][0].": In stock: ".$cars[0][1].", sold: ".$cars[0][2].".<br>";
echo $cars[1][0].": In stock: ".$cars[1][1].", sold: ".$cars[1][2].".<br>";
echo $cars[2][0].": In stock: ".$cars[2][1].", sold: ".$cars[2][2].".<br>";
echo $cars[3][0].": In stock: ".$cars[3][1].", sold: ".$cars[3][2].".<br>";
?>
KUNAL TAMRAJ HARINKHEDE (1912420306)

VII. Conclusion:
The code run successfully and we get required output. Used the php program for creating
and manipulating –
a) Indexed array
b) Associative array
c) Multidimensional array

VIII. AssessmentScheme

S Performance Indicators Weightage in


No. %
1. Completion of given Task. 25%
2. Correctness of given Task. 50%
3. Answer to Sample Questions. 15%
4. Submit Report in Time. 10%
Total 100%

Marks Obtained Dated signature of


Teacher
Process Product Related(15) Total(25)
Related(10)
KUNAL TAMRAJ HARINKHEDE (1912420306)

Practical no 5:
a) Write a php program –
1. Calculate length of string.
2. Count the numbers of words in string –without using string
functions.
b) Write a simple PHP program to demonstrate use of various built in
string functions.
I. Relevant ProgramOutcomes (POs)
 Basic Knowledge: Apply knowledge of basic mathematics, sciences and basic engg
to solve the broad based computer enggproblem.
 Discipline Knowledge: Apply computer engg discipline – specific knowledge to
solve core computer engg relatedproblems.
 Experiments and practice: plan to perform experiments and practices to use the
results to solve broad based computer enggproblems.
 Engineering tools: Apply relevant computer technologies and tools with an
understanding of thelimitations.
 Individual and team work: function effectively as a loader and team member in
diverse/ multidisciplinaryteams.
 Communication: communicate effectively in oral and writtenform.
 Life-long learning: engage in independent and life-long learning activities in the
context of technological changes in the computer engg field and alliedindustry.

II. Relevant Affective Domain relatedOutcome(s)


1. Follow safetypractices.
2. Practice goodhousekeeping.
3. Work as a leader/ a teammember.
4. Follow standard configurationprocedures.
5. Follow ethicalpractices.

III. Course OutcomesAddressed


a) Develop program using controlstatement.
b) Perform operations based on arrays andgraphics.
c) Develop programs by applying various object orientedconcepts.
d) Use form controls with validation to collect user'sinput.
e) Perform database operations inPHP.

IV. Precautions
1. Handle computer systemcarefully.
2. Note down the exact output for eachcase.
KUNAL TAMRAJ HARINKHEDE (1912420306)

V. Additional Resourcesrequired

Sr. Name of Specification Quantity Remarks


No. resource
/material
1 Hardware Approx. Windows 10 Intel i5, As per
Computer System 4GB RAM, 1TB HDD Batch For All
Size Practical’s
2 Software/ Website XAMPP Web Server, Notepad+ 1
+ of PHP

VI. Result(code and output)


a) Write a php program –
1. Calculate length of string.
<?php
echostrlen("pranavwagh");
?>

2. Count the numbers of words in string –without using string functions.


<!DOCTYPE html>
<html>
<body>
<?php
// PHP program to count number
// of words in a string

// Function to count the words


functionget_num_of_words($string) {
$string = preg_replace('/\s+/', '', trim($string));
$words = explode("", $string);
return count($words);
}

$str = " Geeks for Geeks ";

// Function call
$len = get_num_of_words($str);

// Printing the result


echo $len;
?>
KUNAL TAMRAJ HARINKHEDE (1912420306)

</body>
</html>

VII. Conclusion:
The code run successfully and we get required output. Used the different string functions.

VIII. AssessmentScheme

S Performance Indicators Weightage in


No. %
1. Completion of given Task. 25%
2. Correctness of given Task. 50%
3. Answer to Sample Questions. 15%
4. Submit Report in Time. 10%
Total 100%

Marks Obtained Dated signature of


Teacher
Process Product Related(15) Total(25)
Related(10)
KUNAL TAMRAJ HARINKHEDE (1912420306)

Practical no 6:

Write a simple PHP program to demonstrate use of simple function and


parameterized function.
I. Relevant ProgramOutcomes (POs)
 Basic Knowledge: Apply knowledge of basic mathematics, sciences and basic engg
to solve the broad based computer enggproblem.
 Discipline Knowledge: Apply computer engg discipline – specific knowledge to
solve core computer engg relatedproblems.
 Experiments and practice: plan to perform experiments and practices to use the
results to solve broad based computer enggproblems.
 Engineering tools: Apply relevant computer technologies and tools with an
understanding of thelimitations.
 Individual and team work: function effectively as a loader and team member in
diverse/ multidisciplinaryteams.
 Communication: communicate effectively in oral and writtenform.
 Life-long learning: engage in independent and life-long learning activities in the
context of technological changes in the computer engg field and alliedindustry.

II. Relevant Affective Domain relatedOutcome(s)


1. Follow safetypractices.
2. Practice goodhousekeeping.
3. Work as a leader/ a teammember.
4. Follow standard configurationprocedures.
5. Follow ethicalpractices.

III. Course OutcomesAddressed


a) Develop program using controlstatement.
b) Perform operations based on arrays andgraphics.
c) Develop programs by applying various object orientedconcepts.
d) Use form controls with validation to collect user'sinput.
e) Perform database operations inPHP.

IV. Precautions
1. Handle computer systemcarefully.
2. Note down the exact output for eachcase.
KUNAL TAMRAJ HARINKHEDE (1912420306)

V. Additional Resourcesrequired

Sr. Name of Specification Quantity Remarks


No. resource
/material
1 Hardware Approx. Windows 10 Intel i5, As per
Computer System 4GB RAM, 1TB HDD Batch For All
Size Practical’s
2 Software/ Website XAMPP Web Server, Notepad+ 1
+ of PHP

VI. Result (code and output)


<?php  
        //Adding two numbers  
         function add($x, $y) {  
            $sum = $x + $y;  
            echo "Sum of two numbers is = $sum <br><br>";  
         }   
         add(467, 943);  
  
         //Subtracting two numbers  
         function sub($x, $y) {  
            $diff = $x - $y;  
            echo "Difference between two numbers is = $diff";  
}   
         sub(943, 467);  
      ?>  
KUNAL TAMRAJ HARINKHEDE (1912420306)

VII. Conclusion:
The code run successfully and we get required output. Used the function and parameterized
function.

VIII. AssessmentScheme

S Performance Indicators Weightage in


No. %
1. Completion of given Task. 25%
2. Correctness of given Task. 50%
3. Answer to Sample Questions. 15%
4. Submit Report in Time. 10%
Total 100%

Marks Obtained Dated signature of


Teacher
Process Product Related(15) Total(25)
Related(10)
KUNAL TAMRAJ HARINKHEDE (1912420306)

Practical no 7:
Write a simple php program to create pdf document by using graphics concepts.

I. Relevant ProgramOutcomes (POs)


 Basic Knowledge: Apply knowledge of basic mathematics, sciences and basic engg
to solve the broad based computer enggproblem.
 Discipline Knowledge: Apply computer engg discipline – specific knowledge to
solve core computer engg relatedproblems.
 Experiments and practice: plan to perform experiments and practices to use the
results to solve broad based computer enggproblems.
 Engineering tools: Apply relevant computer technologies and tools with an
understanding of thelimitations.
 Individual and team work: function effectively as a loader and team member in
diverse/ multidisciplinaryteams.
 Communication: communicate effectively in oral and writtenform.
 Life-long learning: engage in independent and life-long learning activities in the
context of technological changes in the computer engg field and alliedindustry.

II. Relevant Affective Domain relatedOutcome(s)


1. Follow safetypractices.
2. Practice goodhousekeeping.
3. Work as a leader/ a teammember.
4. Follow standard configurationprocedures.
5. Follow ethicalpractices.

III. Course OutcomesAddressed


a) Develop program using controlstatement.
b) Perform operations based on arrays andgraphics.
c) Develop programs by applying various object orientedconcepts.
d) Use form controls with validation to collect user'sinput.
e) Perform database operations inPHP.

IV. Precautions
1. Handle computer systemcarefully.
2. Note down the exact output for eachcase.

V. Additional Resourcesrequired
Sr. Name of resource Specification Quantity Remarks
No. /material
1 Hardware Approx. Windows 10 Intel i5, As per Batch
Computer System 4GB RAM, 1TB HDD Size For All
2 Software/ Website XAMPP Web Server, Notepad++ 1 Practical’s
of PHP
KUNAL TAMRAJ HARINKHEDE (1912420306)

VI. Result (code and output)

How to generate PDF files with PHP?


FPDF is a PHP class which allows you to generate PDF files and does not depend on
additional PHP libraries.
FPDF is free and can be downloaded from the official website’s download section. The
download package contains all necessary files, along with some tutorials on how to use it.
To upload the package on your account, use FTP or File Manager in Site Tools and extract
it after that. Place the extracted contents in any folder on your account, which will then turn
into the FPDF installation folder.
A basic example of using FPDF is with the following PHP code (you must extract the
FPDF package in the folder where the PHP file with the code is located):
<?php
require(‘./fpdf.php’);

$pdf=newFPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','B',16);
$pdf->Cell(40,10,'Hello World!');
$pdf->Output();
?>
Let’s say that you have downloaded and extracted the FPDF package inside a folder
called ~/public_html/fpdf/. Create a new PHP file called toPDF.php inside the same folder
and insert the above code. Save the file and try to access it through your browser:
http://yourdomain.com/fpdf/toPDF.php
Upon execution, the PHP script will generate a PDF file in your browser.

VII. Conclusion:
The code run successfully and we get required output. Used the php program to create pdf
document by using graphics concepts.
KUNAL TAMRAJ HARINKHEDE (1912420306)

VIII. AssessmentScheme

S Performance Indicators Weightage in


No. %
1. Completion of given Task. 25%
2. Correctness of given Task. 50%
3. Answer to Sample Questions. 15%
4. Submit Report in Time. 10%
Total 100%

Marks Obtained Dated signature of


Teacher
Process Product Related(15) Total(25)
Related(10)

Practical no 8:
KUNAL TAMRAJ HARINKHEDE (1912420306)

Write a php program to-


a) Inherit members to super class in subclass.
b) Create constructor to initialize object of class –by using object
oriented concepts.

I. Relevant ProgramOutcomes (POs)


 Basic Knowledge: Apply knowledge of basic mathematics, sciences and basic engg
to solve the broad based computer enggproblem.
 Discipline Knowledge: Apply computer engg discipline – specific knowledge to
solve core computer engg relatedproblems.
 Experiments and practice: plan to perform experiments and practices to use the
results to solve broad based computer enggproblems.
 Engineering tools: Apply relevant computer technologies and tools with an
understanding of thelimitations.
 Individual and team work: function effectively as a loader and team member in
diverse/ multidisciplinaryteams.
 Communication: communicate effectively in oral and writtenform.
 Life-long learning: engage in independent and life-long learning activities in the
context of technological changes in the computer engg field and alliedindustry.

II. Relevant Affective Domain relatedOutcome(s)


1. Follow safetypractices.
2. Practice goodhousekeeping.
3. Work as a leader/ a teammember.
4. Follow standard configurationprocedures.
5. Follow ethicalpractices.

III. Course OutcomesAddressed


a) Develop program using controlstatement.
b) Perform operations based on arrays andgraphics.
c) Develop programs by applying various object orientedconcepts.
d) Use form controls with validation to collect user'sinput.
e) Perform database operations inPHP.

IV. Precautions
1. Handle computer systemcarefully.
2. Note down the exact output for eachcase.
KUNAL TAMRAJ HARINKHEDE (1912420306)

V. Additional Resourcesrequired

Sr. Name of Specification Quantity Remarks


No. resource
/material
1 Hardware Approx. Windows 10 Intel i5, As per
Computer System 4GB RAM, 1TB HDD Batch For All
Size Practical’s
2 Software/ Website XAMPP Web Server, Notepad+ 1
+ of PHP

VI. Result (code and output)


a) Inherit members to super class in subclass.

<?php
class Fruit {
public $name;
public $color;
public function __construct($name, $color) {
$this->name = $name;
$this->color = $color;
}
public function intro() {
echo"The fruit is {$this->name} and the color is {$this->color}.";
}
}
// Strawberry is inherited from Fruit
class Strawberry extends Fruit {
public function message() {
echo"Am I a fruit or a berry? ";
}
}
$strawberry = new Strawberry("Strawberry", "red");
$strawberry->message();
$strawberry->intro();
?>
KUNAL TAMRAJ HARINKHEDE (1912420306)

b) Create constructor to initialize object of class –by using object oriented concepts.
<?php
class Fruit {
  public $name;
  public $color;

  function __construct($name, $color) {
    $this->name = $name;
    $this->color = $color;
  }
  function get_name() {
    return $this->name;
  }
  function get_color() {
    return $this->color;
  }
}

$apple = new Fruit("Apple", "red");
echo $apple->get_name();
echo "<br>";
echo $apple->get_color();
?>
KUNAL TAMRAJ HARINKHEDE (1912420306)

VII. Conclusion:
The code run successfully and we get required output. Used the inheritance and constructor
in program.

VIII. AssessmentScheme

S Performance Indicators Weightage in


No. %
1. Completion of given Task. 25%
2. Correctness of given Task. 50%
3. Answer to Sample Questions. 15%
4. Submit Report in Time. 10%
Total 100%

Marks Obtained Dated signature of


Teacher
Process Product Related(15) Total(25)
Related(10)
KUNAL TAMRAJ HARINKHEDE (1912420306)

Practical no 9:
Write a simple php program on Introspection and serialization.

I. Relevant ProgramOutcomes (POs)


 Basic Knowledge: Apply knowledge of basic mathematics, sciences and basic engg
to solve the broad based computer enggproblem.
 Discipline Knowledge: Apply computer engg discipline – specific knowledge to
solve core computer engg relatedproblems.
 Experiments and practice: plan to perform experiments and practices to use the
results to solve broad based computer enggproblems.
 Engineering tools: Apply relevant computer technologies and tools with an
understanding of thelimitations.
 Individual and team work: function effectively as a loader and team member in
diverse/ multidisciplinaryteams.
 Communication: communicate effectively in oral and writtenform.
 Life-long learning: engage in independent and life-long learning activities in the
context of technological changes in the computer engg field and alliedindustry.

II. Relevant Affective Domain relatedOutcome(s)


1. Follow safetypractices.
2. Practice goodhousekeeping.
3. Work as a leader/ a teammember.
4. Follow standard configurationprocedures.
5. Follow ethicalpractices.

III. Course OutcomesAddressed


a) Perform operations based on arrays andgraphics.
b) Develop programs by applying various object orientedconcepts.
c) Use form controls with validation to collect user'sinput.
d) Perform database operations inPHP.
e) Develop program using controlstatement.

IV. Precautions
1. Handle computer systemcarefully.
2. Note down the exact output for eachcase.

V. Additional Resourcesrequired

Sr. Name of Specification Quantity Remarks


No. resource
/material
1 Hardware Approx. Windows 10 Intel i5, As per
Computer System 4GB RAM, 1TB HDD Batch For All
Size Practical’s
2 Software/ Website XAMPP Web Server, Notepad+ 1
+ of PHP
KUNAL TAMRAJ HARINKHEDE (1912420306)

VI. Result (code and output)


1. Introspection
<?php
classcwipedia
{
//decl
}
if(class_exists('cwipedia'))
{
$ob=new cwipedia();
echo"This is cwipedia.in";
}
else
{
echo"Not exist";
}

?>

2. Serialzation
<?php
$a=array('Shivam','Rahul','Vilas');
$s=serialize($a);
print_r($s);
$s1=unserialize($s);
echo"<br>";
print_r($s1);
?>
KUNAL TAMRAJ HARINKHEDE (1912420306)

VII. Conclusion:
The code run successfully and we get required output. Used the introspection and
serialization

VIII. AssessmentScheme

S Performance Indicators Weightage in


No. %
1. Completion of given Task. 25%
2. Correctness of given Task. 50%
3. Answer to Sample Questions. 15%
4. Submit Report in Time. 10%
Total 100%

Marks Obtained Dated signature of


Teacher
Process Product Related(15) Total(25)
Related(10)

Practical no 10:
KUNAL TAMRAJ HARINKHEDE (1912420306)

Design a web page using following form controls:


a) Text box
b) Radio button
c) Check box
d) Buttons
I. Relevant ProgramOutcomes (POs)
 Basic Knowledge: Apply knowledge of basic mathematics, sciences and basic engg
to solve the broad based computer enggproblem.
 Discipline Knowledge: Apply computer engg discipline – specific knowledge to
solve core computer engg relatedproblems.
 Experiments and practice: plan to perform experiments and practices to use the
results to solve broad based computer enggproblems.
 Engineering tools: Apply relevant computer technologies and tools with an
understanding of thelimitations.
 Individual and team work: function effectively as a loader and team member in
diverse/ multidisciplinaryteams.
 Communication: communicate effectively in oral and writtenform.
 Life-long learning: engage in independent and life-long learning activities in the
context of technological changes in the computer engg field and alliedindustry.

II. Relevant Affective Domain relatedOutcome(s)


1. Follow safetypractices.
2. Practice goodhousekeeping.
3. Work as a leader/ a teammember.
4. Follow standard configurationprocedures.
5. Follow ethicalpractices.

III. Course OutcomesAddressed


a) Perform operations based on arrays andgraphics.
b) Develop programs by applying various object orientedconcepts.
c) Use form controls with validation to collect user'sinput.
d) Perform database operations inPHP.
e) Develop program using controlstatement.

IV. Precautions
1. Handle computer systemcarefully.
2. Note down the exact output for eachcase.
V. Additional Resourcesrequired
Sr. Name of resource Specification Quantity Remarks
No. /material
1 Hardware Approx. Windows 10 Intel i5, As per Batch
Computer System 4GB RAM, 1TB HDD Size For All
2 Software/ Website XAMPP Web Server, Notepad++ 1 Practical’s
of PHP
KUNAL TAMRAJ HARINKHEDE (1912420306)

VI. Result (code and output)


<!DOCTYPE HTML>  
<html>
<head>
<style>
.error {color: #FF0000;}
</style>
</head>
<body>  

<?php
// define variables and set to empty values
$nameErr = $emailErr = $genderErr = $websiteErr = "";
$name = $email = $gender = $comment = $website = "";

if ($_SERVER["REQUEST_METHOD"] == "POST") {
  if (empty($_POST["name"])) {
    $nameErr = "Name is required";
  } else {
    $name = test_input($_POST["name"]);
    // check if name only contains letters and whitespace
    if (!preg_match("/^[a-zA-Z-' ]*$/",$name)) {
      $nameErr = "Only letters and white space allowed";
    }
  }
  
  if (empty($_POST["email"])) {
    $emailErr = "Email is required";
  } else {
    $email = test_input($_POST["email"]);
    // check if e-mail address is well-formed
    if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
      $emailErr = "Invalid email format";
    }
  }
    
  if (empty($_POST["website"])) {
    $website = "";
  } else {
    $website = test_input($_POST["website"]);
    // check if URL address syntax is valid (this regular expression also allows dashes in the URL)
    if (!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/
%=~_|]/i",$website)) {
      $websiteErr = "Invalid URL";
    }
  }

  if (empty($_POST["comment"])) {
    $comment = "";
  } else {
    $comment = test_input($_POST["comment"]);
  }

  if (empty($_POST["gender"])) {
    $genderErr = "Gender is required";
  } else {
    $gender = test_input($_POST["gender"]);
  }
}

function test_input($data) {
  $data = trim($data);
  $data = stripslashes($data);
  $data = htmlspecialchars($data);
  return $data;
}
?>
KUNAL TAMRAJ HARINKHEDE (1912420306)

<h2>PHP Form Validation Example</h2>


<p><span class="error">* required field</span></p>
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">  
  Name: <input type="text" name="name" value="<?php echo $name;?>">
  <span class="error">* <?php echo $nameErr;?></span>
  <br><br>
  E-mail: <input type="text" name="email" value="<?php echo $email;?>">
  <span class="error">* <?php echo $emailErr;?></span>
  <br><br>
  Website: <input type="text" name="website" value="<?php echo $website;?>">
  <span class="error"><?php echo $websiteErr;?></span>
  <br><br>
  Comment: <textarea name="comment" rows="5" cols="40"><?php echo $comment;?></textarea>
  <br><br>
  Gender:
  <input type="radio" name="gender" <?php if (isset($gender) && $gender=="female") echo "checked";?
> value="female">Female
  <input type="radio" name="gender" <?php if (isset($gender) && $gender=="male") echo "checked";?
> value="male">Male
  <input type="radio" name="gender" <?php if (isset($gender) && $gender=="other") echo "checked";?
> value="other">Other  
  <span class="error">* <?php echo $genderErr;?></span>
  <br><br>
  <input type="submit" name="submit" value="Submit">  
</form>

<?php
echo "<h2>Your Input:</h2>";
echo $name;
echo "<br>";
echo $email;
echo "<br>";
echo $website;
echo "<br>";
echo $comment;
echo "<br>";
echo $gender;
?>

</body>
</html>
KUNAL TAMRAJ HARINKHEDE (1912420306)

VII. Conclusion:
The code run successfully and we get required output. Used Text
box,Radiobutton,Checkbox,Buttons form controls to Design a web page .

VIII. AssessmentScheme

S Performance Indicators Weightage in


No. %
1. Completion of given Task. 25%
2. Correctness of given Task. 50%
3. Answer to Sample Questions. 15%
4. Submit Report in Time. 10%
Total 100%

Marks Obtained Dated signature of


Teacher
Process Product Related(15) Total(25)
Related(10)
KUNAL TAMRAJ HARINKHEDE (1912420306)

Practical no 11:
Design a web page using following form controls:
a) List box
b) Combo box
c) Hidden field box

I. Relevant ProgramOutcomes (POs)


 Basic Knowledge: Apply knowledge of basic mathematics, sciences and basic engg
to solve the broad based computer enggproblem.
 Discipline Knowledge: Apply computer engg discipline – specific knowledge to
solve core computer engg relatedproblems.
 Experiments and practice: plan to perform experiments and practices to use the
results to solve broad based computer enggproblems.
 Engineering tools: Apply relevant computer technologies and tools with an
understanding of thelimitations.
 Individual and team work: function effectively as a loader and team member in
diverse/ multidisciplinaryteams.
 Communication: communicate effectively in oral and writtenform.
 Life-long learning: engage in independent and life-long learning activities in the
context of technological changes in the computer engg field and alliedindustry.

II. Relevant Affective Domain relatedOutcome(s)


1. Follow safetypractices.
2. Practice goodhousekeeping.
3. Work as a leader/ a teammember.
4. Follow standard configurationprocedures.
5. Follow ethicalpractices.

III. Course OutcomesAddressed


a) Perform operations based on arrays andgraphics.
b) Develop programs by applying various object orientedconcepts.
c) Use form controls with validation to collect user'sinput.
d) Perform database operations inPHP.
e) Develop program using controlstatement.

IV. Precautions
1. Handle computer systemcarefully.
2. Note down the exact output for eachcase.
KUNAL TAMRAJ HARINKHEDE (1912420306)

V. Additional Resourcesrequired

Sr. Name of Specification Quantity Remarks


No. resource
/material
1 Hardware Approx. Windows 10 Intel i5, As per
Computer System 4GB RAM, 1TB HDD Batch For All
Size Practical’s
2 Software/ Website XAMPP Web Server, Notepad+ 1
+ of PHP

VI. Result (code and output)


KUNAL TAMRAJ HARINKHEDE (1912420306)
KUNAL TAMRAJ HARINKHEDE (1912420306)

VII. Conclusion:
The code run successfully and we get required output.

VIII. AssessmentScheme

S Performance Indicators Weightage in


No. %
1. Completion of given Task. 25%
2. Correctness of given Task. 50%
3. Answer to Sample Questions. 15%
4. Submit Report in Time. 10%
Total 100%

Marks Obtained Dated signature of


Teacher
Process Product Related(15) Total(25)
Related(10)
KUNAL TAMRAJ HARINKHEDE (1912420306)

Practical no 12:
Develop a web page with data validation.

I. Relevant ProgramOutcomes (POs)


 Basic Knowledge: Apply knowledge of basic mathematics, sciences and basic engg
to solve the broad based computer enggproblem.
 Discipline Knowledge: Apply computer engg discipline – specific knowledge to
solve core computer engg relatedproblems.
 Experiments and practice: plan to perform experiments and practices to use the
results to solve broad based computer enggproblems.
 Engineering tools: Apply relevant computer technologies and tools with an
understanding of thelimitations.
 Individual and team work: function effectively as a loader and team member in
diverse/ multidisciplinaryteams.
 Communication: communicate effectively in oral and writtenform.
 Life-long learning: engage in independent and life-long learning activities in the
context of technological changes in the computer engg field and alliedindustry.

II. Relevant Affective Domain relatedOutcome(s)


1. Follow safetypractices.
2. Practice goodhousekeeping.
3. Work as a leader/ a teammember.
4. Follow standard configurationprocedures.
5. Follow ethicalpractices.

III. Course OutcomesAddressed


a) Perform operations based on arrays andgraphics.
b) Develop programs by applying various object orientedconcepts.
c) Use form controls with validation to collect user'sinput.
d) Perform database operations inPHP.
e) Develop program using controlstatement.

IV. Precautions
1. Handle computer systemcarefully.
2. Note down the exact output for eachcase.

V. Additional Resourcesrequired
Sr. Name of Specification Quantity Remarks
No. resource
/material
1 Hardware Approx. Windows 10 Intel i5, As per
Computer System 4GB RAM, 1TB HDD Batch For All
Size Practical’s
2 Software/ Website XAMPP Web Server, Notepad+ 1
+ of PHP
KUNAL TAMRAJ HARINKHEDE (1912420306)

VI. Result (code and output)


Code reference in practical 10

VII. Conclusion:
The code run successfully and we get required output. Developed the webpage with
validation.
KUNAL TAMRAJ HARINKHEDE (1912420306)

VIII. AssessmentScheme

S Performance Indicators Weightage in


No. %
1. Completion of given Task. 25%
2. Correctness of given Task. 50%
3. Answer to Sample Questions. 15%
4. Submit Report in Time. 10%
Total 100%

Marks Obtained Dated signature of


Teacher
Process Product Related(15) Total(25)
Related(10)
KUNAL TAMRAJ HARINKHEDE (1912420306)

Practical no 13:
Write a simple program to -
a) Set cookies and read it.
b) Demonstrate session management
I. Relevant ProgramOutcomes (POs)
 Basic Knowledge: Apply knowledge of basic mathematics, sciences and basic engg
to solve the broad based computer enggproblem.
 Discipline Knowledge: Apply computer engg discipline – specific knowledge to
solve core computer engg relatedproblems.
 Experiments and practice: plan to perform experiments and practices to use the
results to solve broad based computer enggproblems.
 Engineering tools: Apply relevant computer technologies and tools with an
understanding of thelimitations.
 Individual and team work: function effectively as a loader and team member in
diverse/ multidisciplinaryteams.
 Communication: communicate effectively in oral and writtenform.
 Life-long learning: engage in independent and life-long learning activities in the
context of technological changes in the computer engg field and alliedindustry.

II. Relevant Affective Domain relatedOutcome(s)


1. Follow safetypractices.
2. Practice goodhousekeeping.
3. Work as a leader/ a teammember.
4. Follow standard configurationprocedures.
5. Follow ethicalpractices.

III. Course OutcomesAddressed


a) Perform operations based on arrays andgraphics.
b) Develop programs by applying various object orientedconcepts.
c) Use form controls with validation to collect user'sinput.
d) Perform database operations inPHP.
e) Develop program using controlstatement.

IV. Precautions
1. Handle computer systemcarefully.
2. Note down the exact output for eachcase.
V. Additional Resourcesrequired
Sr. Name of Specification Quantity Remarks
No. resource
/material
1 Hardware Approx. Windows 10 Intel i5, As per
Computer System 4GB RAM, 1TB HDD Batch For All
Size Practical’s
2 Software/ Website XAMPP Web Server, Notepad+ 1
+ of PHP
KUNAL TAMRAJ HARINKHEDE (1912420306)

VI. Result (code and output)


a) Set cookies and read it.
<?php  
setcookie("user", "Sonoo");  
?>  
<html>  
<body>  
<?php  
if(!isset($_COOKIE["user"])) {  
    echo "Sorry, cookie is not found!";  
} else {  
    echo "<br/>Cookie Value: " . $_COOKIE["user"];  
}  
?>  
</body>  
</html>

Output:
Sorry, cookie is not found!

b) Demonstrate session management


<?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>
KUNAL TAMRAJ HARINKHEDE (1912420306)

VII. Conclusion:
The code run successfully and we get required output. Used the a simple program to -
a) Set cookies and read it.
b) Demonstrate session management

VIII. AssessmentScheme

S Performance Indicators Weightage in


No. %
1. Completion of given Task. 25%
2. Correctness of given Task. 50%
3. Answer to Sample Questions. 15%
4. Submit Report in Time. 10%
Total 100%

Marks Obtained Dated signature of


Teacher
Process Product Related(15) Total(25)
Related(10)

Practical no 14:
KUNAL TAMRAJ HARINKHEDE (1912420306)

Write a simple PHP program for sending and receiving plain text message
(e-mail).
I. Relevant ProgramOutcomes (POs)
 Basic Knowledge: Apply knowledge of basic mathematics, sciences and basic engg
to solve the broad based computer enggproblem.
 Discipline Knowledge: Apply computer engg discipline – specific knowledge to
solve core computer engg relatedproblems.
 Experiments and practice: plan to perform experiments and practices to use the
results to solve broad based computer enggproblems.
 Engineering tools: Apply relevant computer technologies and tools with an
understanding of thelimitations.
 Individual and team work: function effectively as a loader and team member in
diverse/ multidisciplinaryteams.
 Communication: communicate effectively in oral and writtenform.
 Life-long learning: engage in independent and life-long learning activities in the
context of technological changes in the computer engg field and alliedindustry.

II. Relevant Affective Domain relatedOutcome(s)


1. Follow safetypractices.
2. Practice goodhousekeeping.
3. Work as a leader/ a teammember.
4. Follow standard configurationprocedures.
5. Follow ethicalpractices.

III. Course OutcomesAddressed


a) Perform operations based on arrays andgraphics.
b) Develop programs by applying various object orientedconcepts.
c) Use form controls with validation to collect user'sinput.
d) Perform database operations inPHP.
e) Develop program using controlstatement.

IV. Precautions
1. Handle computer systemcarefully.
2. Note down the exact output for eachcase.

V. Additional Resourcesrequired
Sr. Name of Specification Quantity Remarks
No. resource
/material
1 Hardware Approx. Windows 10 Intel i5, As per
Computer System 4GB RAM, 1TB HDD Batch For All
Size Practical’s
2 Software/ Website XAMPP Web Server, Notepad+ 1
+ of PHP

VI. Result (code and output)


KUNAL TAMRAJ HARINKHEDE (1912420306)

<?php
$to = "somebody@example.com";
$subject = "My subject";
$txt = "Hello world!";
$headers = "From: webmaster@example.com" . "\r\n" .
"CC: somebodyelse@example.com";

mail($to,$subject,$txt,$headers);
?>
OR
<?php
extract($_POST);
if(isset($sendmail))
{
$subject ="Mail Function in PHP";
$from="info@phptpoint.com";
$message =$name."".$mobile."".$query;
$headers = "From:".$from;
mail($email,$subject,$message,$headers);

echo"<h3 align='center'>Mail Sent Successfully</h3>";


}
?>

<html>
<body>
<?php
$to_email = "pranavwagh955@gmail.com";
$subject = "Simple Email Test PHP pranav";
$body = "Hi, This is Test Email Send by PHP program ";
$headers = "From: pranav2001@gmail.com";

if (mail($to_email, $subject, $body, $headers)) {


echo"Email Successfully Sent To $to_email...";
} else {
echo"Email sending failed...";
}
?>
</body>
</html>

VII. Conclusion:
KUNAL TAMRAJ HARINKHEDE (1912420306)

The code run successfully and we get required output.

VIII. AssessmentScheme

S Performance Indicators Weightage in


No. %
1. Completion of given Task. 25%
2. Correctness of given Task. 50%
3. Answer to Sample Questions. 15%
4. Submit Report in Time. 10%
Total 100%

Marks Obtained Dated signature of


Teacher
Process Product Related(15) Total(25)
Related(10)

Practical no 15:
KUNAL TAMRAJ HARINKHEDE (1912420306)

Develop a simple application to -


a) Enter data into database
b) Retrieve and present data from database.
I. Relevant ProgramOutcomes (POs)
 Basic Knowledge: Apply knowledge of basic mathematics, sciences and basic engg
to solve the broad based computer enggproblem.
 Discipline Knowledge: Apply computer engg discipline – specific knowledge to
solve core computer engg relatedproblems.
 Experiments and practice: plan to perform experiments and practices to use the
results to solve broad based computer enggproblems.
 Engineering tools: Apply relevant computer technologies and tools with an
understanding of thelimitations.
 Individual and team work: function effectively as a loader and team member in
diverse/ multidisciplinaryteams.
 Communication: communicate effectively in oral and writtenform.
 Life-long learning: engage in independent and life-long learning activities in the
context of technological changes in the computer engg field and alliedindustry.

II. Relevant Affective Domain relatedOutcome(s)


1. Follow safetypractices.
2. Practice goodhousekeeping.
3. Work as a leader/ a teammember.
4. Follow standard configurationprocedures.
5. Follow ethicalpractices.

III. Course OutcomesAddressed


a) Perform operations based on arrays andgraphics.
b) Develop programs by applying various object orientedconcepts.
c) Use form controls with validation to collect user'sinput.
d) Perform database operations inPHP.
e) Develop program using controlstatement.

IV. Precautions
1. Handle computer systemcarefully.
2. Note down the exact output for eachcase.
V. Additional Resourcesrequired
Sr. Name of Specification Quantity Remarks
No. resource
/material
1 Hardware Approx. Windows 10 Intel i5, As per
Computer System 4GB RAM, 1TB HDD Batch For All
Size Practical’s
2 Software/ Website XAMPP Web Server, Notepad+ 1
+ of PHP

VI. Result (code and output)


KUNAL TAMRAJ HARINKHEDE (1912420306)

Database Connection: The collection of related data is called a database. XAMPP stands


for cross-platform, Apache, MySQL, PHP, and Perl. It is among the simple light-
weight local servers for website development. In PHP, we can connect to database
using localhost XAMPP web server.
Filename: index.php
<!DOCTYPE html>
<html lang="en">
  
<head>
    <title>GFG- Store Data</title>
</head>
  
<body>
    <center>
        <h1>Storing Form data in Database</h1>
  
        <form action="insert.php" method="post">
              
            <p>
                <label for="firstName">First Name:</label>
                <input type="text" name="first_name" id="firstName">
            </p>
              
            <p>
                <label for="lastName">Last Name:</label>
                <input type="text" name="last_name" id="lastName">
            </p>
 
            <p>
                <label for="Gender">Gender:</label>
                <input type="text" name="gender" id="Gender">
            </p>
            <p>
                <label for="Address">Address:</label>
                <input type="text" name="address" id="Address">
            </p>
 
            <p>
                <label for="emailAddress">Email Address:</label>
                <input type="text" name="email" id="emailAddress">
            </p>
            <input type="submit" value="Submit">
        </form>
    </center>
</body>
  
</html>

Filename: insert.php
KUNAL TAMRAJ HARINKHEDE (1912420306)

<!DOCTYPE html>
<html>
  
<head>
    <title>Insert Page page</title>
</head>
  
<body>
    <center>
        <?php
  
        // servername =>localhost
        // username => root
        // password => empty
        // database name => staff
        $conn = mysqli_connect("localhost", "root", "", "staff");
          
        // Check connection
        if($conn === false){
            die("ERROR: Could not connect. " 
                . mysqli_connect_error());
        }
          
        // Taking all 5 values from the form data(input)
        $first_name =  $_REQUEST['first_name'];
        $last_name = $_REQUEST['last_name'];
        $gender =  $_REQUEST['gender'];
        $address = $_REQUEST['address'];
        $email = $_REQUEST['email'];
          
        // Performing insert query execution
        // here our table name is college
        $sql = "INSERT INTO college  VALUES ('$first_name', 
            '$last_name','$gender','$address','$email')";
          
        if(mysqli_query($conn, $sql)){
            echo"<h3>data stored in a database successfully." 
                . " Please browse your localhost php my admin" 
                . " to view the updated data</h3>"; 
  
            echo nl2br("\n$first_name\n $last_name\n "
                . "$gender\n $address\n $email");
        } else{
            echo"ERROR: Hush! Sorry $sql. " 
                . mysqli_error($conn);
        }
          
        // Close connection
        mysqli_close($conn);
KUNAL TAMRAJ HARINKHEDE (1912420306)

        ?>
    </center>
</body>
  
</html>
KUNAL TAMRAJ HARINKHEDE (1912420306)

or

https://drive.google.com/file/d/1XLQm51pp9jhP9IxiTdM-RpYqxL9PyB43/view?usp=drivesdk

Application is available in this link

VII. Conclusion:
Practical 15 is all used in my micro project the link is given above for results.
Develop a simple application to -
 Enter data into database
 Retrieve and present data from database.

VIII. AssessmentScheme

S Performance Indicators Weightage in


No. %
1. Completion of given Task. 25%
2. Correctness of given Task. 50%
3. Answer to Sample Questions. 15%
4. Submit Report in Time. 10%
Total 100%

Marks Obtained Dated signature of


Teacher
Process Product Related(15) Total(25)
Related(10)

Practical no 16:
KUNAL TAMRAJ HARINKHEDE (1912420306)

Develop a simple application to update, delete table data from database.

I. Relevant ProgramOutcomes (POs)


 Basic Knowledge: Apply knowledge of basic mathematics, sciences and basic engg
to solve the broad based computer enggproblem.
 Discipline Knowledge: Apply computer engg discipline – specific knowledge to
solve core computer engg relatedproblems.
 Experiments and practice: plan to perform experiments and practices to use the
results to solve broad based computer enggproblems.
 Engineering tools: Apply relevant computer technologies and tools with an
understanding of thelimitations.
 Individual and team work: function effectively as a loader and team member in
diverse/ multidisciplinaryteams.
 Communication: communicate effectively in oral and writtenform.
 Life-long learning: engage in independent and life-long learning activities in the
context of technological changes in the computer engg field and alliedindustry.

II. Relevant Affective Domain relatedOutcome(s)


1. Follow safetypractices.
2. Practice goodhousekeeping.
3. Work as a leader/ a teammember.
4. Follow standard configurationprocedures.
5. Follow ethicalpractices.

III. Course OutcomesAddressed


a) Perform operations based on arrays andgraphics.
b) Develop programs by applying various object orientedconcepts.
c) Use form controls with validation to collect user'sinput.
d) Perform database operations inPHP.
e) Develop program using controlstatement.

IV. Precautions
1. Handle computer systemcarefully.
2. Note down the exact output for eachcase.
V. Additional Resourcesrequired

Sr. Name of Specification Quantity Remarks


No. resource
/material
1 Hardware Approx. Windows 10 Intel i5, As per
Computer System 4GB RAM, 1TB HDD Batch For All
Size Practical’s
2 Software/ Website XAMPP Web Server, Notepad+ 1
+ of PHP

VI. Result (code and output)


KUNAL TAMRAJ HARINKHEDE (1912420306)

1 – DB.PHP – Connecting Database

First of all, Create db.php file to connecting mysql database with PHP:

1 <?php
2     $host='localhost';
3     $username='root';
4     $password='';
5     $dbname= "mydb";
6     $conn=mysqli_connect($host,$username,
7 $password,"$dbname");
8     if(!$conn)
9         {
1           die('Could not Connect MySql
0 Server:'.mysql_error());
1         }
1 ?>

2 – Insert.PHP – Insert Records IntoMySQL DB

Then, Create a new file named insert.php and add the following code into insert.php:

1 <?php
2 include_once'db.php';
3  
4     
5      $firstname= 'Hello';
6      $lastname= 'Test';
7      $mobile= '9874561230';
8  
9      $sql= "INSERT INTO users
1 (firstname,lastname,mobile)
0      VALUES
1 ('$name','$email','$mobile')";
1  
1      if(mysqli_query($conn, $sql)) {
2         echo"New record has been added
1 successfully !";
3      } else{
1         echo"Error: ". $sql.":-".
4 mysqli_error($conn);
1      }
5      mysqli_close($conn);
1  
6 ?>
1
7
1
8
1
KUNAL TAMRAJ HARINKHEDE (1912420306)

Note that, The SQL INSERT statement will insert record in MySQL database using PHP
function.

3 – Select.php – Select Record FromMySQL DB

Then, create a new file named Select.php and add the following code into selete.php:

1
2
3
4 <?php
5 include_once'db.php';
6  
7 $sql= "SELECT * FROM users";
8  
9 $query= mysqli_query($conn,$sql);
1  
0 if(!$query)
1 {
1     echo"Query does not
1 work.".mysqli_error($conn);die;
2 }
1  
3 while($data=
1 mysqli_fetch_array($query))
4 {
1     echo"Id = ".$data['id']."<br>";
5     echo"Firstname = ".
1 $data['firstname']."<br>";
6     echo"Lastname = ".
1 $data['lastname']."<br>";
7     echo"Mobile = ".
1 $data['mobile']."<br><hr>";
8 }
1 ?>
9
2
0

Note that, The SQL SELECT statement will SELECT record FROM MySQL database
using PHP function.
KUNAL TAMRAJ HARINKHEDE (1912420306)

If you want to select limited records from MySQL database, you can use LIMIT clause
with SQL query like following:

1 $sql = "SELECT * FROM users Limit 10";

Or, if you want to fetch record with ascending or descending order. So, you can use ASC
OR DESC with SQL query.

4 – Update.php – Update Record IntoMySQL DB

Now, you can modify database table records using SQL “UPDATE “ statement query. 

So, Create a new file named Update.php and add the following code into update.php:

<?php
1  
2 include_once'db.php';
3  
4 $sql= "UPDATE users SET firstname = 'Hello',lastname =
5 'Test',mobile = '9874561230' WHERE id=1 ";
6  
7 $query= mysqli_query($conn,$sql);
8 if(!$query)
9 {
10     echo"Query does not
11 work.".mysqli_error($conn);die;
12 }
13 else
14 {
15     echo"Data successfully updated";
16 }
17  
18    
?>

5 – Delete.php – Delete Record FromMySQL DB

If you want to delete some records or all records from database, you can
use DELETE SQL statement with PHP.

So, Create a new file named Delete.php and add the following code into delete.php:

1 <?php
2     include_once'db.php';
3  
4     $sql= "DELETE FROM users WHERE
5 userid='". $_GET["userid"] . "'";
6  
7     if(mysqli_query($conn, $sql)) {
8  
        echo"Record deleted
KUNAL TAMRAJ HARINKHEDE (1912420306)

9
1
0 successfully";
1  
1     } else{
1      
2         echo"Error deleting record: ".
1 mysqli_error($conn);
3     }
1     mysqli_close($conn);
4 ?>
1
5
or

VII. Conclusion:
Developed a simple application to update, delete table data from database. Is provide in
drive link.

VIII. AssessmentScheme

S Performance Indicators Weightage in


No. %
1. Completion of given Task. 25%
2. Correctness of given Task. 50%
3. Answer to Sample Questions. 15%
4. Submit Report in Time. 10%
Total 100%

Marks Obtained Dated signature of


Teacher
Process Product Related(15) Total(25)
Related(10)
KUNAL TAMRAJ HARINKHEDE (1912420306)

You might also like