SlideShare a Scribd company logo
Php   a dynamic web scripting language
P - PHP
H - Hypertext
P - Preprocessor
 PHP is an acronym for “PHP
Hypertext Preprocessor”. (Originally,
„Personal Home Page’). It was
created by Rasmus Lerdorf in 1995 to
maintain his personal home page
 PHP is a widely-used server scripting
language, and is a powerful tool for
making dynamic and interactive
web pages quickly
 PHP is an object-oriented
programming language, which
means that you can create objects,
which can contain variables and
functions
 PHP scripts are executed on the server
 PHP is an open source software
 PHP costs nothing, it is free to
download and use
PHP files can contain text, HTML,
CSS, JavaScript and PHP code
PHP files are executed on the
server and the result are returned
to the browser as plain HTML
PHP files have extension “.php”
To start using PHP, you can:
Find a web host with PHP and
MySQL Support
Install a web server on your own
PC, and then install PHP and
MySQL
Visit www.php.net for free download.
Download XAMPP installer
XAMPP is an all-in-one installer
package of local server, MySql
and PHP
* Take a look at this video on how to install XAMPP
Php   a dynamic web scripting language
1. Go to XAMPP directory folder
located in local disk C: & open it
2. Click the “htdocs” folder
3. Create your own folder inside
that „htdocs’
4. Put/save all your PHP Files inside
your own folder
*Remember: Never rename or delete any default folder/s
inside XAMPP directory except that of your own folder
*Take the ff. steps every time you want to
test/run your PHP files?
1. Open XAMPP Control Panel
2. Click the „Start‟ button of the Apache
Server and of the MySQL if your PHP has a
database
3. Open any web browser (Chrome,
IE,Firefox, Safari etc)
4. Type in the address bar
“localhost/yourfoldername” & press Enter
button
<?php
//php code goes here
?>
.php
Example: myfirstproject.php
File Name File Extension
<html>
<body>
<?php
echo "Hello World";
print “Hello World”;
?>
</body>
</html>
Example:
There are two basic statements to
output or send text to the browser:
echo or print
Example:
echo "Hello World";
print “Hello World”;
Each code line in PHP must end with a semicolon (;).
The semicolon is a separator and is used to
distinguish one set of instructions from another.
<html>
<body>
<?php
//This is a single line comment
# This is also a single line comment
/*
This is a multiple lines comment
block that spans over more than one line
*/
?>
</body>
</html>
Variables are “containers” for storing information. It
can store values like text strings, numbers or
arrays.
Rules for PHP variables:
 A variable starts with a $ (sigil) sign, followed by the
name of the variable.
 A variable name must start with a letter or the underscore
character
 A variable name cannot start with a number
 A variable name can only contain alpha-numeric
characters and underscores (A-z, 0-9, and _)
 Variable names are case sensitive ($y and $Y are two
different variables)
The correct way of declaring a variable in PHP:
$var_name = value;
Example:
<?php
$text="Hello Math!";
$x=5;
$y=6;
$z=$x+$y;
echo $z;
?>
Remember: (put quotes for text variable’s value)
(no quotes needed for number variable’s value)
 All user-defined functions, classes, and keywords
(e.g. if, else, while, echo, etc.) are case-
insensitive
Example 1:
<?php
EcHo “Hello World!”;
echo “Hello World!”;
ECHO “Hello World!”;
?>
all three echo
statements are
legal (and
equal)
 All variables are case-sensitive
Example:
<?php
$color=”red”;
echo “My car is “ . $color;
echo “My car is “ . $COLOR;
echo “My car is “ . $coLOR;
?>
only the first
statement will
display the
value of the
$color variable
( .) – Concatenator
The concatenation operator (.) is used to
put two string values together.
Example:
<?php
$txt1="Hello World!";
$txt2="What a nice day!";
echo $txt1 . " " . $txt2;
?>
The output of the code above will be:
Hello World! What a nice day!
Operators are used to operate on values.
Arithmetic Operators
Assignment Operators
Comparison Operators
Logical Operators
+ - * / % ++ --
= += -= *= /= .= %=
== != <> > < >= <=
&& and
II or
! not
Conditional Statements
The if...else Statement
Use the if....else statement to execute some code if a
condition is true and another code if a condition is false.
 Syntax
if (condition)
code to be executed if condition is true;
else
code to be executed if condition is false;
The if...else Statement
Example:
<html>
<body>
<?php
$d=date("D");
if ($d=="Fri")
echo "Have a nice weekend!";
else
echo "Have a nice day!";
?>
</body>
</html>
Conditional Statements
The if...elseif....else Statement
Use the if....elseif...else statement to select one of several
blocks of code to be executed.
 Syntax
if (condition)
code to be executed if condition is true;
elseif (condition)
code to be executed if condition is true;
else
code to be executed if condition is false;
The if...elseif....else Statement
Example:
<?php
$d=date("D");
if ($d=="Fri")
echo "Have a nice weekend!";
elseif ($d=="Sun")
echo "Have a nice Sunday!";
else
echo "Have a nice day!";
?>
Conditional statements are used to perform
different actions based on different conditions.
 Syntax
switch (n)
{
case label1:
code to be executed if n=label1;
break;
case label2:
code to be executed if n=label2;
break;
default:
code to be executed if n is different from both label1
and label2;
}
Example:
<?php
switch ($x)
{
case 1:
echo "Number 1";
break;
case 2:
echo "Number 2";
break;
case 3:
echo "Number 3";
break;
default:
echo "No number between 1 and 3";
}
?>
PHP $_POST Function
The built-in „$_POST‟ function is
used to collect values in a form
with method="post".
PHP $_POST Function
Example:
<form action="welcome.php" method="post">
Name: <input type="text" name="fname" />
Age: <input type="text" name="age" />
<input type="submit" />
</form>
When the user clicks the "Submit" button, the
"welcome.php" file can now use the $_POST function to
collect form data
Welcome <?php echo $_POST["fname"]; ?>!<br />
You are <?php echo $_POST["age"]; ?> years old.
Output could be something like this:
Welcome John!
You are 28 years old.
Problem:
How to create a program that
inputs „student name‟,
„attendance grade‟, „quiz grade‟,
„project grade‟, & „major exam
grade‟ with an output of student
name, total grade and remarks
using PHP?
<html>
<body>
<h1> Student Grade:</h1>
<form action="compute.php" method="post">
Student Name:<input type="text" name="sname" />
<br>
Attendance Grade:<input type="text" name="agrade" />
<br>
Quiz Grade:<input type="text" name="qgrade" />
<br>
Project Grade: <input type="text" name="pgrade" />
<br>
Major Exam Grade:<input type="text" name="egrade" />
<br>
<input type="submit" value="Compute"/>
</form>
</body>
Create this first
file and Save
this as
studentgrade.
php
PHP file #1
<html>
<body>
<?php
echo $_POST["sname"];
?>
<br>
<?php
$attgrade = $_POST['agrade'];
$quizgrade = $_POST['qgrade'];
$prograde = $_POST['pgrade'];
$megrade = $_POST['egrade'];
$total = ($attgrade * 0.10) + ($quizgrade * 0.15) + ($prograde * 0.25)
+ ($megrade * 0.50);
?>
<br>
PHP file #2
<?php
echo 'Total Grade:' . $total;
?>
<br>
<?php
if ($total >= 75) {
echo "Remarks: Passed!";
}
else {
echo "Remarks: Failed!";
}
?>
</body>
</html>
Create this
second file
and Save this
as
compute.php
and run/test
the two files
Save this file as
compute.php
INPUT OUTPUT
THANK YOU!

More Related Content

What's hot (20)

PPTX
Php
Shyam Khant
 
PPTX
Php Unit 1
team11vgnt
 
PPTX
Constructor and encapsulation in php
SHIVANI SONI
 
PPT
Chapter 02 php basic syntax
Dhani Ahmad
 
PPT
PHP Tutorials
Yuriy Krapivko
 
PPTX
Php.ppt
Nidhi mishra
 
PDF
Php introduction
krishnapriya Tadepalli
 
PPTX
PHP slides
Farzad Wadia
 
PPSX
PHP Comprehensive Overview
Mohamed Loey
 
PPTX
Dev traning 2016 basics of PHP
Sacheen Dhanjie
 
PPT
Php Lecture Notes
Santhiya Grace
 
PPTX
Php Tutorial
pratik tambekar
 
PPT
PHP MySQL Workshop - facehook
Shashank Skills Academy
 
PPTX
PHP
Steve Fort
 
PPT
PHP Workshop Notes
Pamela Fox
 
PPT
PHP complete reference with database concepts for beginners
Mohammed Mushtaq Ahmed
 
PPT
PHP - Introduction to PHP Fundamentals
Vibrant Technologies & Computers
 
PDF
Introduction to php basics
baabtra.com - No. 1 supplier of quality freshers
 
PPTX
php basics
Anmol Paul
 
PPTX
Basic of PHP
Nisa Soomro
 
Php Unit 1
team11vgnt
 
Constructor and encapsulation in php
SHIVANI SONI
 
Chapter 02 php basic syntax
Dhani Ahmad
 
PHP Tutorials
Yuriy Krapivko
 
Php.ppt
Nidhi mishra
 
Php introduction
krishnapriya Tadepalli
 
PHP slides
Farzad Wadia
 
PHP Comprehensive Overview
Mohamed Loey
 
Dev traning 2016 basics of PHP
Sacheen Dhanjie
 
Php Lecture Notes
Santhiya Grace
 
Php Tutorial
pratik tambekar
 
PHP MySQL Workshop - facehook
Shashank Skills Academy
 
PHP
Steve Fort
 
PHP Workshop Notes
Pamela Fox
 
PHP complete reference with database concepts for beginners
Mohammed Mushtaq Ahmed
 
PHP - Introduction to PHP Fundamentals
Vibrant Technologies & Computers
 
php basics
Anmol Paul
 
Basic of PHP
Nisa Soomro
 

Viewers also liked (16)

PDF
Pgdca final syllabus_2007_revised_31st_july_2007
litu9439
 
DOCX
Computer basic course
dharmendra kumar
 
DOCX
pcb making in hindi pdf( à€Șà„€à€žà„€à€Źà„€ à€Źà€šà€Ÿà€šà„‡ à€•à„€ à€”à€żà€§à€ż à€čà€żà€‚à€Šà„€ à€źà„‡à€‚ )
Chand Rook
 
PDF
Router components in hindi
Vipin sharma
 
PDF
Pagemaker hindi notes
Badal Rajput
 
PDF
C language in hindi (cà€Čà„‡à€—à„à€”à„‡à€œ à€‡à€š à€čà€żà€‚à€Šà„€ )
Chand Rook
 
PPT
Introduction To PHP
Shweta A
 
PPTX
PHP Powerpoint -- Teach PHP with this
Ian Macali
 
PDF
Computer netwoking notes & qustionspart 2
SirajRock
 
PDF
Photoshop hindi-notes
SirajRock
 
PDF
Networking in hindi notes
SirajRock
 
PDF
Excel shortcut and function keys hindi notes
SirajRock
 
PDF
Internet notes hindi
SirajRock
 
PDF
Introduction of Internet Hindi Notes
SirajRock
 
PDF
Microsoft office hindi notes
SirajRock
 
PDF
Corel draw 14 hindi notes
SirajRock
 
Pgdca final syllabus_2007_revised_31st_july_2007
litu9439
 
Computer basic course
dharmendra kumar
 
pcb making in hindi pdf( à€Șà„€à€žà„€à€Źà„€ à€Źà€šà€Ÿà€šà„‡ à€•à„€ à€”à€żà€§à€ż à€čà€żà€‚à€Šà„€ à€źà„‡à€‚ )
Chand Rook
 
Router components in hindi
Vipin sharma
 
Pagemaker hindi notes
Badal Rajput
 
C language in hindi (cà€Čà„‡à€—à„à€”à„‡à€œ à€‡à€š à€čà€żà€‚à€Šà„€ )
Chand Rook
 
Introduction To PHP
Shweta A
 
PHP Powerpoint -- Teach PHP with this
Ian Macali
 
Computer netwoking notes & qustionspart 2
SirajRock
 
Photoshop hindi-notes
SirajRock
 
Networking in hindi notes
SirajRock
 
Excel shortcut and function keys hindi notes
SirajRock
 
Internet notes hindi
SirajRock
 
Introduction of Internet Hindi Notes
SirajRock
 
Microsoft office hindi notes
SirajRock
 
Corel draw 14 hindi notes
SirajRock
 
Ad

Similar to Php a dynamic web scripting language (20)

PPTX
Php
Shagufta shaheen
 
DOCX
Basic php 5
Engr. Raud Ahmed
 
PPTX
Day1
IRWAA LLC
 
PPTX
Php by shivitomer
Shivi Tomer
 
PPTX
FYBSC IT Web Programming Unit IV PHP and MySQL
Arti Parab Academics
 
PPTX
Introduction to php
Taha Malampatti
 
DOCX
PHP NOTES FOR BEGGINERS
Aminiel Michael
 
PDF
WT_PHP_PART1.pdf
HambardeAtharva
 
PPTX
The basics of php for engeneering students
rahuljustin77
 
PDF
Web Development Course: PHP lecture 1
Gheyath M. Othman
 
PPSX
Php and MySQL
Tiji Thomas
 
DOCX
Free PHP Book Online | PHP Development in India
Deepak Rajput
 
PDF
Introduction to PHP - Basics of PHP
wahidullah mudaser
 
PPT
Php Tutorial
SHARANBAJWA
 
PPT
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)
Muhamad Al Imran
 
PPT
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)
Muhamad Al Imran
 
PPT
Php i basic chapter 3
Muhamad Al Imran
 
PDF
basic concept of php(Gunikhan sonowal)
Guni Sonow
 
PPTX
Intro to php
Ahmed Farag
 
PPTX
PHP.pptx is the Best Explanation of ppts
AkhileshPansare
 
Basic php 5
Engr. Raud Ahmed
 
Day1
IRWAA LLC
 
Php by shivitomer
Shivi Tomer
 
FYBSC IT Web Programming Unit IV PHP and MySQL
Arti Parab Academics
 
Introduction to php
Taha Malampatti
 
PHP NOTES FOR BEGGINERS
Aminiel Michael
 
WT_PHP_PART1.pdf
HambardeAtharva
 
The basics of php for engeneering students
rahuljustin77
 
Web Development Course: PHP lecture 1
Gheyath M. Othman
 
Php and MySQL
Tiji Thomas
 
Free PHP Book Online | PHP Development in India
Deepak Rajput
 
Introduction to PHP - Basics of PHP
wahidullah mudaser
 
Php Tutorial
SHARANBAJWA
 
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)
Muhamad Al Imran
 
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)
Muhamad Al Imran
 
Php i basic chapter 3
Muhamad Al Imran
 
basic concept of php(Gunikhan sonowal)
Guni Sonow
 
Intro to php
Ahmed Farag
 
PHP.pptx is the Best Explanation of ppts
AkhileshPansare
 
Ad

Recently uploaded (20)

PPTX
MiniTool Power Data Recovery Full Crack Latest 2025
muhammadgurbazkhan
 
PPTX
WYSIWYG Web Builder Crack 2025 – Free Download Full Version with License Key
HyperPc soft
 
PDF
Rewards and Recognition (2).pdf
ethan Talor
 
PPTX
For my supp to finally picking supp that work
necas19388
 
PPTX
Comprehensive Guide: Shoviv Exchange to Office 365 Migration Tool 2025
Shoviv Software
 
PPTX
ManageIQ - Sprint 264 Review - Slide Deck
ManageIQ
 
PDF
Code Once; Run Everywhere - A Beginner’s Journey with React Native
Hasitha Walpola
 
PDF
>Wondershare Filmora Crack Free Download 2025
utfefguu
 
PPTX
CONCEPT OF PROGRAMMING in language .pptx
tamim41
 
PDF
LPS25 - Operationalizing MLOps in GEP - Terradue.pdf
terradue
 
PDF
From Chaos to Clarity: Mastering Analytics Governance in the Modern Enterprise
Wiiisdom
 
PDF
>Nitro Pro Crack 14.36.1.0 + Keygen Free Download [Latest]
utfefguu
 
PDF
Continouous failure - Why do we make our lives hard?
Papp KrisztiĂĄn
 
PPTX
computer forensics encase emager app exp6 1.pptx
ssuser343e92
 
PDF
IDM Crack with Internet Download Manager 6.42 Build 41
utfefguu
 
PPTX
Mistakes to Avoid When Selecting Policy Management Software
Insurance Tech Services
 
PDF
Transparency into Your Software’s True Reach
team-WIBU
 
PPTX
Quality on Autopilot: Scaling Testing in Uyuni
Oscar Barrios Torrero
 
PPTX
ERP - FICO Presentation BY BSL BOKARO STEEL LIMITED.pptx
ravisranjan
 
PDF
capitulando la keynote de GrafanaCON 2025 - Madrid
Imma Valls Bernaus
 
MiniTool Power Data Recovery Full Crack Latest 2025
muhammadgurbazkhan
 
WYSIWYG Web Builder Crack 2025 – Free Download Full Version with License Key
HyperPc soft
 
Rewards and Recognition (2).pdf
ethan Talor
 
For my supp to finally picking supp that work
necas19388
 
Comprehensive Guide: Shoviv Exchange to Office 365 Migration Tool 2025
Shoviv Software
 
ManageIQ - Sprint 264 Review - Slide Deck
ManageIQ
 
Code Once; Run Everywhere - A Beginner’s Journey with React Native
Hasitha Walpola
 
>Wondershare Filmora Crack Free Download 2025
utfefguu
 
CONCEPT OF PROGRAMMING in language .pptx
tamim41
 
LPS25 - Operationalizing MLOps in GEP - Terradue.pdf
terradue
 
From Chaos to Clarity: Mastering Analytics Governance in the Modern Enterprise
Wiiisdom
 
>Nitro Pro Crack 14.36.1.0 + Keygen Free Download [Latest]
utfefguu
 
Continouous failure - Why do we make our lives hard?
Papp KrisztiĂĄn
 
computer forensics encase emager app exp6 1.pptx
ssuser343e92
 
IDM Crack with Internet Download Manager 6.42 Build 41
utfefguu
 
Mistakes to Avoid When Selecting Policy Management Software
Insurance Tech Services
 
Transparency into Your Software’s True Reach
team-WIBU
 
Quality on Autopilot: Scaling Testing in Uyuni
Oscar Barrios Torrero
 
ERP - FICO Presentation BY BSL BOKARO STEEL LIMITED.pptx
ravisranjan
 
capitulando la keynote de GrafanaCON 2025 - Madrid
Imma Valls Bernaus
 

Php a dynamic web scripting language

  • 2. P - PHP H - Hypertext P - Preprocessor
  • 3.  PHP is an acronym for “PHP Hypertext Preprocessor”. (Originally, „Personal Home Page’). It was created by Rasmus Lerdorf in 1995 to maintain his personal home page  PHP is a widely-used server scripting language, and is a powerful tool for making dynamic and interactive web pages quickly
  • 4.  PHP is an object-oriented programming language, which means that you can create objects, which can contain variables and functions  PHP scripts are executed on the server  PHP is an open source software  PHP costs nothing, it is free to download and use
  • 5. PHP files can contain text, HTML, CSS, JavaScript and PHP code PHP files are executed on the server and the result are returned to the browser as plain HTML PHP files have extension “.php”
  • 6. To start using PHP, you can: Find a web host with PHP and MySQL Support Install a web server on your own PC, and then install PHP and MySQL Visit www.php.net for free download.
  • 7. Download XAMPP installer XAMPP is an all-in-one installer package of local server, MySql and PHP * Take a look at this video on how to install XAMPP
  • 9. 1. Go to XAMPP directory folder located in local disk C: & open it 2. Click the “htdocs” folder 3. Create your own folder inside that „htdocs’ 4. Put/save all your PHP Files inside your own folder *Remember: Never rename or delete any default folder/s inside XAMPP directory except that of your own folder
  • 10. *Take the ff. steps every time you want to test/run your PHP files? 1. Open XAMPP Control Panel 2. Click the „Start‟ button of the Apache Server and of the MySQL if your PHP has a database 3. Open any web browser (Chrome, IE,Firefox, Safari etc) 4. Type in the address bar “localhost/yourfoldername” & press Enter button
  • 13. <html> <body> <?php echo "Hello World"; print “Hello World”; ?> </body> </html> Example:
  • 14. There are two basic statements to output or send text to the browser: echo or print Example: echo "Hello World"; print “Hello World”; Each code line in PHP must end with a semicolon (;). The semicolon is a separator and is used to distinguish one set of instructions from another.
  • 15. <html> <body> <?php //This is a single line comment # This is also a single line comment /* This is a multiple lines comment block that spans over more than one line */ ?> </body> </html>
  • 16. Variables are “containers” for storing information. It can store values like text strings, numbers or arrays. Rules for PHP variables:  A variable starts with a $ (sigil) sign, followed by the name of the variable.  A variable name must start with a letter or the underscore character  A variable name cannot start with a number  A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _)  Variable names are case sensitive ($y and $Y are two different variables)
  • 17. The correct way of declaring a variable in PHP: $var_name = value; Example: <?php $text="Hello Math!"; $x=5; $y=6; $z=$x+$y; echo $z; ?> Remember: (put quotes for text variable’s value) (no quotes needed for number variable’s value)
  • 18.  All user-defined functions, classes, and keywords (e.g. if, else, while, echo, etc.) are case- insensitive Example 1: <?php EcHo “Hello World!”; echo “Hello World!”; ECHO “Hello World!”; ?> all three echo statements are legal (and equal)
  • 19.  All variables are case-sensitive Example: <?php $color=”red”; echo “My car is “ . $color; echo “My car is “ . $COLOR; echo “My car is “ . $coLOR; ?> only the first statement will display the value of the $color variable
  • 20. ( .) – Concatenator The concatenation operator (.) is used to put two string values together. Example: <?php $txt1="Hello World!"; $txt2="What a nice day!"; echo $txt1 . " " . $txt2; ?> The output of the code above will be: Hello World! What a nice day!
  • 21. Operators are used to operate on values. Arithmetic Operators Assignment Operators Comparison Operators Logical Operators + - * / % ++ -- = += -= *= /= .= %= == != <> > < >= <= && and II or ! not
  • 22. Conditional Statements The if...else Statement Use the if....else statement to execute some code if a condition is true and another code if a condition is false.  Syntax if (condition) code to be executed if condition is true; else code to be executed if condition is false;
  • 23. The if...else Statement Example: <html> <body> <?php $d=date("D"); if ($d=="Fri") echo "Have a nice weekend!"; else echo "Have a nice day!"; ?> </body> </html>
  • 24. Conditional Statements The if...elseif....else Statement Use the if....elseif...else statement to select one of several blocks of code to be executed.  Syntax if (condition) code to be executed if condition is true; elseif (condition) code to be executed if condition is true; else code to be executed if condition is false;
  • 25. The if...elseif....else Statement Example: <?php $d=date("D"); if ($d=="Fri") echo "Have a nice weekend!"; elseif ($d=="Sun") echo "Have a nice Sunday!"; else echo "Have a nice day!"; ?>
  • 26. Conditional statements are used to perform different actions based on different conditions.  Syntax switch (n) { case label1: code to be executed if n=label1; break; case label2: code to be executed if n=label2; break; default: code to be executed if n is different from both label1 and label2; }
  • 27. Example: <?php switch ($x) { case 1: echo "Number 1"; break; case 2: echo "Number 2"; break; case 3: echo "Number 3"; break; default: echo "No number between 1 and 3"; } ?>
  • 28. PHP $_POST Function The built-in „$_POST‟ function is used to collect values in a form with method="post".
  • 29. PHP $_POST Function Example: <form action="welcome.php" method="post"> Name: <input type="text" name="fname" /> Age: <input type="text" name="age" /> <input type="submit" /> </form> When the user clicks the "Submit" button, the "welcome.php" file can now use the $_POST function to collect form data Welcome <?php echo $_POST["fname"]; ?>!<br /> You are <?php echo $_POST["age"]; ?> years old. Output could be something like this: Welcome John! You are 28 years old.
  • 30. Problem: How to create a program that inputs „student name‟, „attendance grade‟, „quiz grade‟, „project grade‟, & „major exam grade‟ with an output of student name, total grade and remarks using PHP?
  • 31. <html> <body> <h1> Student Grade:</h1> <form action="compute.php" method="post"> Student Name:<input type="text" name="sname" /> <br> Attendance Grade:<input type="text" name="agrade" /> <br> Quiz Grade:<input type="text" name="qgrade" /> <br> Project Grade: <input type="text" name="pgrade" /> <br> Major Exam Grade:<input type="text" name="egrade" /> <br> <input type="submit" value="Compute"/> </form> </body> Create this first file and Save this as studentgrade. php PHP file #1
  • 32. <html> <body> <?php echo $_POST["sname"]; ?> <br> <?php $attgrade = $_POST['agrade']; $quizgrade = $_POST['qgrade']; $prograde = $_POST['pgrade']; $megrade = $_POST['egrade']; $total = ($attgrade * 0.10) + ($quizgrade * 0.15) + ($prograde * 0.25) + ($megrade * 0.50); ?> <br> PHP file #2
  • 33. <?php echo 'Total Grade:' . $total; ?> <br> <?php if ($total >= 75) { echo "Remarks: Passed!"; } else { echo "Remarks: Failed!"; } ?> </body> </html> Create this second file and Save this as compute.php and run/test the two files
  • 34. Save this file as compute.php INPUT OUTPUT