Internet and Web Programming CSE-3002 Digital Assignment - 1
Internet and Web Programming CSE-3002 Digital Assignment - 1
Name: S.Mahendra
Reg No:18BCE0009
Slot: L23+L24
Faculty: Prof.Rajkumar. R
QUESTION 1:
CODE:
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<form action="colors.php" method=POST>
18BCE0009
Output:
18BCE0009
QUESTION 2:
Write an HTML file that contains a form and a PHP program that processes the data from the
form. The form should contain some questions that the user can answer, and the PHP program
should produce a response that incorporates the user's answers in some way. The first two forms
on this page are examples of this sort of thing, but your work should be a little longer and more
imaginative.
CODE:
<h1>Enter your detals and marks to calculate cgpa.</h1>
<form method="POST">
Enter your name:<input type="text" name="name">
</br>
Enter your registration number:<input type="text" name="reg">
</br>
Enter your branch:<input type="text" name="branch"> </br>
Enter your subject-1 marks:<input type="text" name="sub1">
</br>
Enter your subject-2 marks:<input type="text" name="sub2">
</br>
Enter your subject-3 marks:<input type="text" name="sub3">
</br>
Enter your subject-4 marks:<input type="text" name="sub4">
</br>
<input type="submit" name="submit">
</form>
<?php
18BCE0009
$nm=$_POST['name'];
$reg=$_POST['reg'];
$br=$_POST['branch'];
$sub1=$_POST['sub1'];
$sub2=$_POST['sub2'];
$sub3=$_POST['sub3'];
$sub4=$_POST['sub4'];
echo "Hye,";echo $nm;
echo '</br>';
echo "your registration number is";echo $reg; echo '</br>';
echo "Your branch is:";echo $br;
echo '</br>';
$tot=$sub1+$sub2+$sub3+$sub4;
$out=400;
$grade='F';
$per = (($tot) / $out) * 100;
echo "Your percentage is:"; echo $per; echo "%"; if($per>='90'){
$grade='A';
}
else{
if($per>='80' && $per<'90')
{
$grade='B';
}
else{
if($per>='70' && $per<'80'){
18BCE0009
$grade='C';
}
else{
if($per>='60' && $per<'70'){
$grade='D';
}
else{
if($per>='50' && $per<'60'){
$grade='E';
}
else{
$grade='F';
}
}
}
}
}
echo '</br>';
echo "Your grade is:";echo $grade;
echo '</br>';
if($grade=='F'){
echo 'Sorry..!!you have failed in this semester.';
}
else{
echo "Congratss..!!! You cleared this semester.";
}
18BCE0009
?>
</body>
</html>
OUTPUT: