CS511 ASSIGNMENT NO. 2 SPRING 2023 || 100% RIGHT SOLUTION || WEB ENGINEERING || BY VuTech
Visit Website For More Solutions
www.vutechofficial.blogspot.com
KINDLY, DON’T COPY PASTE
QUESTION-1:
You are required to create an html page having text field in which student will enter the marks and click submit button. The application should have the following interface as shown in figure-1 mentioned below:Figure1: MarksInput.html will facilitate the user to enter the marks of the student. Once the marks have been entered, the system will show the student grad using the php script written in “calculategrade.php” file. The grade will be shown as follows.
Note:
You are required to write the scripts for both the html and php pages to check student grade based on the following scheme.
- If marks are 60% or more, grade will be “A-Grade”.
- If marks between 45% to 59%, grade will be “B-Grade”.
- If marks between 33% to 44%, grade will be “C-Grade”.
- If marks are less than 33%, student will be “Fail”.
Furthermore, please note that solution scripts will be submitted in .zip folder.
Solution:
HTML CODE
<!DOCTYPE html><html><head> <title>Student Grade Calculator</title></head><body> <h2>Enter Student Marks</h2> <form action="calculategrade.php" method="post"> <label for="marks">Enter Marks:</label> <input type="text" id="marks" name="marks"> <input type="submit" value="Submit"> </form></body></html>PHP SCRIPT
<!DOCTYPE html>
<html>
<head>
<title>Student Grade Result</title>
</head>
<body>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$marks = $_POST["marks"];
if ($marks >= 60) {
$grade = "A-Grade";
} else if ($marks >= 45 && $marks <= 59) {
$grade = "B-Grade";
} else if ($marks >= 33 && $marks <= 44) {
$grade = "C-Grade";
} else {
$grade = "Fail";
}
echo "<h2>Student Grade Result:</h2>";
echo "<p>Marks: " . $marks . "</p>";
echo "<p>Grade: " . $grade . "</p>";
}
?>
</body>
</html>
KINDLY, DON’T COPY PASTE
SUBSCRIBE, SHARE, LIKE AND COMMENTS FOR MORE UPDATES
SEND WHATSAPP OR E-MAIL FOR ANY QUERY
0325-6644800
kamranhameedvu@gmail.com
Visit Website For More Solutions
www.vutechofficial.blogspot.com