0% found this document useful (0 votes)
41 views3 pages

Codinglanguage 2

This document contains HTML and PHP code to create a web form that allows a user to enter a student's name, course name, and three exam scores. It then uses the submitted data to calculate the student's average grade for that course by weighting each exam score and outputting the result. The form inputs are submitted to a PHP file that calculates the average score by multiplying each exam score by its weighting (.2, .3, .5) and adding them together. It then displays the student's name, course, and calculated average score.

Uploaded by

api-285648078
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)
41 views3 pages

Codinglanguage 2

This document contains HTML and PHP code to create a web form that allows a user to enter a student's name, course name, and three exam scores. It then uses the submitted data to calculate the student's average grade for that course by weighting each exam score and outputting the result. The form inputs are submitted to a PHP file that calculates the average score by multiplying each exam score by its weighting (.2, .3, .5) and adding them together. It then displays the student's name, course, and calculated average score.

Uploaded by

api-285648078
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/ 3

Activity 3

HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html
xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type"
content="text/html; charset=UTF-8" /> <title>Test averages</title> </head> <body>
<form id="form1" name="form1" method="post" action="testaverages.php"> <p>
<label for="textfield">Enter the sudents name </label> <input type="text"
name="name" id="textfield" /> </p> <p> <label for="textfield2">Enter the course
name</label> <input type="text" name="course" id="textfield2" /> </p> <p>
<label for="textfield3">Enter the students first exam score</label> <input type="text"
name="exam1" id="textfield3" /> </p> <p> <label for="textfield4">Enter the
students second exam score </label> <input type="text" name="exam2"
id="textfield4" /> </p> <p> <label for="textfield5">Enter the students final exam
score </label> <input type="text" name="exam3" id="textfield5" /> </p> <p>Find
the average final grade <input type="submit" name="button" id="button"
value="Submit" /> </p> </form> </body> </html>
PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html
xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type"
content="text/html; charset=UTF-8" /> <title>Untitled Document</title> </head>
<body> <?php $Enterthesudentsname=$_POST["name"];
$Enterthecoursename=$_POST["course"];
$Enterthestudentsfirstexamscore=$_POST["exam1"];
$Enterthestudentssecondexamscore=$_POST["exam2"];

$Enterthestudentsfinalexamscore=$_POST["exam3"];
$average=$Enterthestudentsfirstexamscore*.2+$Enterthestudentssecondexamscore*.3+$
Enterthestudentsfinalexamscore*.5; echo "$Enterthesudentsname $Enterthecoursename
your score is in the programming course is ($average)"; ?> </body> </html>

You might also like