$val = $POST["name"];
if($_POST['mydropdown'] == 'a'){
switch($val){
case ($val>=70):
echo "13 - 15 First Class Honours";
break;
case ($val>=60):
echo "10 - 12 Upper Second Class Honours";
break;
case ($val>=50):
echo "7 - 9 Lower Second Class Honours";
break;
case ($val>=40):
echo "4 - 6 Third Class Honours";
break;
default:
echo "0 - 3 Fail";
}
}
I also tried this way:
$val = $POST["name"];
if (isset($_POST['submit']))
{
//echo $_POST["name"];
}
switch ($_POST['mydropdown']){
case 'a':
if (( $val >=70) and ($val <=100)) {
echo "13 - 15 First Class Honours";
}
else if (( $val >=60)and($val <= 69))
{
echo "10 - 12 Upper Second Class Honours";
}
//echo $_POST["name"];
else if (( $val >=50)and($val <= 59))
{
echo "7 - 9 Lower Second Class Honours";
}
else if (( $val >=40)and($val <= 49))
{
echo "4 - 6 Third Class Honours";
}
else if (( $val >=0)and($val <= 39))
{
echo "0 - 3 Fail";
}
break;
case 'b':
echo 'You chose B';
break;
case 'c':
echo 'You chose C';
break;
}
?>
Ive asked about it on yahoo answers and thats where I got the first version of code that I posted, but that didnt work either, the first version of code outputs only "first class honours" and the second version only outputs "fail" no matter what I enter in the textfield
Any help?


Sign In
Create Account


Back to top









