Codinglanguage 2
Codinglanguage 2
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>