0% found this document useful (0 votes)
166 views7 pages

Internet and Web Programming CSE-3002 Digital Assignment - 1

The document contains two questions asking to write HTML code. For the first question, the code provided creates a form with fields to collect a user's name and color preference. The form submits to a PHP file that prints a response page with the selected background color and a greeting using the submitted name. For the second question, the code creates a form to collect a student's details and marks in four subjects. The PHP code calculates the student's percentage, grade, and prints a result message indicating if they passed or failed for the semester.

Uploaded by

MAHENDRA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
166 views7 pages

Internet and Web Programming CSE-3002 Digital Assignment - 1

The document contains two questions asking to write HTML code. For the first question, the code provided creates a form with fields to collect a user's name and color preference. The form submits to a PHP file that prints a response page with the selected background color and a greeting using the submitted name. For the second question, the code creates a form to collect a student's details and marks in four subjects. The PHP code calculates the student's percentage, grade, and prints a result message indicating if they passed or failed for the semester.

Uploaded by

MAHENDRA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

18BCE0009

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

<table align=center cellpadding=5 border=3 bgcolor='#DDDDDD'> <tr>


<td>What is your name?</td>
<td align=left><input type=text name=user size=20 id="user"></td>
</tr>
<tr>
<td>Pick a color:</td>
<td align=left>
<select name=color>
<option>Red
<option>Green
<option>Blue
<option>Gray
</select>
</td>
</tr>
<tr>
<td colspan=2 align=center><input type=submit></td>
</tr>
</table>
</form>
</body>
</html>
<?php
$user=$_POST['user'];
$color=$_POST['color'];
print("<body text='black' bgcolor='$color'> "); print("<h2>Hye welcome,$user </h2>");
print("<p>Background color shows your selection:</p>"); if ($color == "Red") {
18BCE0009

print("<p>you have choosen <b>red</b> color</p>")


}
else if ($color == "Blue")
{
print("<p>you have choosen <b>blue</b> color");
}
else if ($color == "Green")
{
print("<p>You have choosen <b>green</b> color ");
}
else {
print("<p>You have choosen <b>Gray</b> color.</p>");
} ?>

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:

You might also like