Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

?Introduction to JavaScript with XML and PHP Chp 4 Challenge 6 Create a web page

ID: 3923483 • Letter: #

Question

?Introduction to JavaScript with XML and PHP Chp 4 Challenge 6

Create a web page that uses a loop to allow a teacher to enter the following information for all students in a class: student's name, midterm exam grade, final exam grade, homework grade, attendance grade. The program should calculate each student's numeric total grade based on the following formula: grade = (midterm * 0.3) + (final * 0.4) + (homework * 0.2) + (attendance * 0.1) Display the results in a JavaScript-generated table as shown: save your page as points .html and be sure to include an appropriate page title.

Explanation / Answer

insert.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR...ransitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>

<script>
function Totalgrade()
{
  
var mg=document.fname.mg.value;
var fg=document.fname.fg.value;
var hg=document.fname.hg.value;
var ag=document.fname.ag.value;
var tgrade=(mg*0.3)+(fg*0.4)+(hg*0.2)+(ag*0.1);

var r=tgrade;

document.fname.tg.value=r;
}


</script>
</head>
<body>
<p>Please fill following Data</p>
<Form action="display.php" method="post" name="fname">
Name : <input type="text" name="name" /><br>
MidTerm Exam Grade : <input type="text" name="mg" /><br>
Final Exam Grade : <input type="text" name="fg" /><br>
HomeWork Grade : <input type="text" name="hg" /><br>
Attendance Grade : <input type="text" name="ag" /><br>
Total Grade:<input type="Text" name="tg"/>

<input type="submit" id="submit" value="Submit">
</Form>
</body>
</html>

convert data into xml using with php

<?PHP
$s_id = $_POST['id'];
$s_name = $_POST['name'];

echo $s_id. '<br>' .$s_name;
$xml =new DOMDocument("1.0");
$xml->load("xmlphp1.xml");

$root=$xml->getElementsByTagName("students")->item(0);
$student=c_element("student",$root);

$id=c_element("id", $student);
c_value("$s_id",$id);

$name = c_element("name", $student);
c_value("$s_name",$name);

//$xml= new DOMDocument("1.0","utf-8");
//$employee = $xml->createElement("employee");
//$employee = $xml->appendChild($employee);

//$empname = $xml->createElement("empname",$name);
//$empname = $employee->appendChild($empname);

//$empemail = $xml->createElement("empemail",$email);
//$price= $employee->appendChild($empemail);

$xml->FormatOutput=true;
//$string_value=$xml->saveXML();
$xml->save("xmlphp1.xml");

?>

please change fileds no time that way

and display normal javascript fromat

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote