Sujal Moradiya-21id01it021
Sujal Moradiya-21id01it021
Sujal Moradiya-21id01it021
21ID01IT021
Practical 5
$number = $_POST['number'];
echo "Factorial of $number:<br><br>";
<html>
<head>
<title>Practical 5</title>
</head>
<body>
<form method="post" action="cmp.php">
Enter the first number:<br>
<input type="text" name="num1"><br>
Enter the second number:<br>
<input type="text" name="num2"><br>
Enter the third number:<br>
<input type="text" name="num3"><br>
Enter the fourth number:<br>
<input type="text" name="num4"><br>
Enter the fifth number:<br>
<input type="text" name="num5">
<br>
<input type="submit" name="submit">
</form>
</body>
</html>
Page 2
<?php
if(isset($_POST["submit"]))
{
$num1=$_POST["num1"];
$num2=$_POST["num2"];
$num3=$_POST["num3"];
$num4=$_POST["num4"];
$num5=$_POST["num5"];
if($num1>$num2 && $num1>$num3 && $num1>$num4 && $num1>$num5)
{
echo $num1;
}
else
{
if($num2>$num1 && $num2>$num3 && $num2>$num4 && $num2>$num5)
{
echo $num2;
}
else
{
if($num3>$num1 && $num3>$num2 && $num3>$num4 && $num3>$num5)
{
echo $num3;
}
else
{
if($num4>$num1 && $num4>$num2 && $num4>$num3 && $num4>$num5)
{
echo $num4;
}
else
{
if($num5>$num1 && $num5>$num2 && $num5>$num3 && $num5>$num4)
{
echo $num5;
}
}
}
}
}
}
?>
4.Create an interface to input the result details of
the student and print the entries on the next page
in the form of a table. Entries should be:
a. Name
b. Enrolment Number
c. Marks of Five Subjects
d. Grade calculation using script
e. Total Marks calculation using script
<html>
<body bgcolor="#959595">
<table border="5px">
<tr>
<td>
Name :
</td>
<td>
<?php
echo $_POST["name"];
?>
</td>
</tr>
<tr>
<td>
Enrollment no :
</td>
<td>
<?php
echo $_POST["en"];
?>
</td>
</tr>
<tr>
<td>
Web Tech :
</td>
<td>
<?php
echo $_POST["s1"];
?>
</td>
</tr>
<tr>
<td>
Java :
</td>
<td>
<?php
echo $_POST["s2"];
?>
</td>
</tr>
<tr>
<td>
Application development :
</td>
<td>
<?php
echo $_POST["s3"];
?>
</td>
</tr>
<tr>
<td>
C:
</td>
<td>
<?php
echo $_POST["s4"];
?>
</td>
</tr>
<tr>
<td>
Python :
</td>
<td>
<?php
echo $_POST["s5"];
?>
</td>
</tr>
<tr>
<td>
Total marks obtain :
</td>
<td>
<?php
$marks =
$_POST["s1"]+$_POST["s2"]+$_POST["s3"]+$_POST["s4"]+$_POST["s5"];
echo $marks;
?>
</td>
</tr>
<tr>
<td>
Percentage :
</td>
<td>
<?php
$percent = $marks* 100 /$_POST["to"];
echo $percent." %";
?>
</td>
</tr>
<tr>
<td>
Grade :
</td>
<td>
<?php
if ($percent>=90)
{ echo "A+ Pass";
}
elseif ($percent>=80 && $percent<=90)
{ echo "A Pass";
}
elseif ($percent>=70 && $percent<=80)
{ echo "B+ Pass";
}
elseif ($percent>=60 && $percent<=70)
{ echo "B Pass";
}
elseif ($percent>=50 && $percent<=60)
{ echo "C Pass";
}
elseif ($percent>=40 && $percent<=50) {
echo "D Pass"; } elseif ($percent>=36
&& $percent<=40)
{ echo "E Pass";
}
elseif ($percent>=0 && $percent<=36)
{ echo "F Fail"; }
else {
echo "Invalid answer";
}
?>
</td>
</tr>
</table>
</body>
</html>