₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,325,282 members, 8,421,174 topics. Date: Friday, 05 June 2026 at 09:44 PM

Toggle theme

PHP Developers, Please Come In - Webmasters - Nairaland

Nairaland ForumScience/TechnologyWebmastersPHP Developers, Please Come In (825 Views)

1 Reply (Go Down)

PHP Developers, Please Come In by Akotechonline(op): 9:55pm On Nov 27, 2019
i want the script to echo a statement if the number is between 20-30..
i.e
if($result == "70-100"wink //If the result is between 70 to 100 { echo " You scored A"; }
Re: PHP Developers, Please Come In by wwwmaster:
$result = 23;
if (($result >= 20) && ($result <= 30)) {
echo "Congrats! You scored : A!";
} else {
echo "Missed, sorry!";
}


You can also use in_array() function

$result = 23;
if (in_array($result, range(20, 30), true)) {
echo "Congrats! You scored : A!";
} else {
echo "Missed, sorry.";
}
Re: PHP Developers, Please Come In by wwwmaster: 11:18pm On Nov 27, 2019
Please note that the 23 I assigned to the variable $result is just for test purpose, normally you should get it from the database or even from simple HTML form submission.
Re: PHP Developers, Please Come In by 2ray4sure: 7:10am On Nov 28, 2019
Akotechonline:
i want the script to echo a statement if the number is between 20-30..

i.e

if($result == "70-100"wink //If the result is between 70 to 100
{
echo " You scored A";
}
Do this
It has been tested. If you need further clarification. Pls contact me .


<?php

if(isset($_POST["submit"])){

$result= $_POST["result"];

if($result <= 39) {echo " Your Grade is F"; return;}

if($result > 39 && $result <= 45) {echo " Your Grade is E"; return;}

if($result > 45 && $result <= 50) {echo " Your Grade is D "; return;}

if($result > 50 && $result <= 60) {echo " Your Grade is C"; return;}

if($result > 60 && $result <= 70) {echo " Your Grade is B"; return;}

if($result > 70 && $result < 101) {echo " Your Grade is A"; return;}

}

?>

Psl Enter Your Result:<br>
<form method="post" action="">


<input type="text" name="result">

<input type="submit" name="submit" value="Check Greade">

</form>
Re: PHP Developers, Please Come In by Akotechonline(op): 8:01am On Nov 28, 2019
2ray4sure:
Do this It has been tested. If you need further clarification. Pls contact me .

<?php
if(isset($_POST["submit"])){
$result= $_POST["result"];
if($result <= 39) {echo " Your Grade is F"; return;}
if($result > 39 && $result <= 45) {echo " Your Grade is E"; return;}
if($result > 45 && $result <= 50) {echo " Your Grade is D "; return;}
if($result > 50 && $result <= 60) {echo " Your Grade is C"; return;}
if($result > 60 && $result <= 70) {echo " Your Grade is B"; return;}
if($result > 70 && $result < 101) {echo " Your Grade is A"; return;}
}
?>
Psl Enter Your Result:<br> <form method="post" action="">

<input type="text" name="result">
<input type="submit" name="submit" value="Check Greade">
</form>
Thanks, I now get the clue bro!
Re: PHP Developers, Please Come In by Akotechonline(op):
2ray4sure:
Do this
It has been tested. If you need further clarification. Pls contact me .


<?php

if(isset($_POST["submit"])){

$result= $_POST["result"];

if($result <= 39) {echo " Your Grade is F"; return;}

if($result > 39 && $result <= 45) {echo " Your Grade is E"; return;}

if($result > 45 && $result <= 50) {echo " Your Grade is D "; return;}

if($result > 50 && $result <= 60) {echo " Your Grade is C"; return;}

if($result > 60 && $result <= 70) {echo " Your Grade is B"; return;}

if($result > 70 && $result < 101) {echo " Your Grade is A"; return;}

}

?>

Psl Enter Your Result:<br>
<form method="post" action="">


<input type="text" name="result">

<input type="submit" name="submit" value="Check Greade">

</form>
i later used ElseIf instead of constantly if statement celebration.
Re: PHP Developers, Please Come In by 2ray4sure:
Good .

The source code and screen shot is available here https://www.naijaitguys.com.ng/Title/simple-grading-system-in-php

You can also leave comment if you have more questions.
1 Reply

Developers Please I Need Your Help UrgentlyWeb Developers Please Help!!!Web Developers, Please Don't Make The Mistake I Made!234

Binary Options, Forex Trading, Bitcoin Trading PHP ScriptsHow To Improve My Youtube Channel With 25k View, 85 Subscriber & 3600 Watch TimeMgid Account With $52 For Sale