Jo$h
Posting Freak
- Jul 7, 2010
- 1,030
- 79
Alright, So I am working with My First PHP Script, located below.
I've Posted it to a website,
And it works fine, but I recieve an error stating that I am Dividing by zero, and I want to remove that. If I could get help that would be great.
Thanks, Jo$h
I've Posted it to a website,
You must be registered for see links
And it works fine, but I recieve an error stating that I am Dividing by zero, and I want to remove that. If I could get help that would be great.
PHP:
<HTML>
<HEAD>
<TITLE> Assignment Worth Calculator</title>
</head>
<body><font face="Arial"><center>
<form action="index.php" method ="post">
Total Questions: <input type="text" name="TotalQs" value="25"><br>
Correct Questions: <input type="text" name="CorrectQs" value="25"><br>
<input type="submit" value="Calculate Me">
</form>
<?php
if($_POST["TotalQs"] == "0") {
echo "Assignments Generally Do Not have 0 Questions";
}
if($_POST["CorrectQs"] == "0") {
echo "You Should Already know your grade";
}
$initialProblem=$_POST["CorrectQs"]/$_POST["TotalQs"];
$step2=$initialProblem*100;
echo "Your Grade is: ";
echo "$step2";
echo "%";
?>
<br>
Created by Josh Johnston
</center>
</font>
</body>
</html>