0

can I ask a question? how can I accept inputs in PHP......


here is the code.....

<html>
<body>
<h4>Grade Form</h4>

<form action="testingform.php" method="post"/> 
Grade: <input name="Grade" type="text" /> 
</form>

<?php

if ($grade>="75") 
{
 echo "PASSED";
}
else($grade<="75")
{
 echo " FAILED";
}
?>

</body>
</html>

the condition is if I put any number, either the passed or failed output should displayed....how should I do it....

3
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by divyakrishnan
-1

this should help

<html>
<body>
<h4>Grade Form</h4>

<form action="test4.php" method="post"/> 
Grade: <input name="Grade" type="text" /> 
<input type="submit" name="submit" value="Submit">
</form>

<?php
if (isset($_POST['submit'])) {
	$grade = 0;
	$grade = (int)$_POST['Grade'];
	if ($grade>="75") {	
	 echo "Your grade was " . $grade . " Congratulations you PASSED!";
	} else if ($grade<="75") {
	 echo "Your grade was " . $grade . " FAIL!";
	} else {
		echo "Error calculating amount";
	}
}
?>

</body>
</html>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.