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....

Recommended Answers

All 2 Replies

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>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.