ckroon
Posts: 869
|
| Posted: 01/04/2008, 1:35 PM |
|
I have a form where I need to insert a value when the record is updated.
A grade is being entered in a separate field and I need the form to calculate the credits that the student earned.
A grade of A, B or C is equal to 5 credits while anything else (D, F, W) is equal to 0 credits.
What would be the simplest way to accomplish this?
_________________
Walter Kempees...you are dearly missed. |
 |
 |
Aaron
Posts: 145
|
| Posted: 01/04/2008, 1:42 PM |
|
I would do a case statement. Or an if/elseif statement. http://us3.php.net/switch
If/else statement ...
if ($i == 0) {
echo "i equals 0";
} elseif ($i == 1) {
echo "i equals 1";
} elseif ($i == 2) {
echo "i equals 2";
}
Switch statement
switch ($i) {
case 0:
echo "i equals 0";
break;
case 1:
echo "i equals 1";
break;
case 2:
echo "i equals 2";
break;
}
Obviously change the echo statements to something to set values, etc.
|
 |
 |
ckroon
Posts: 869
|
| Posted: 01/06/2008, 12:45 PM |
|
Thanks Aaron!
Worked great!
_________________
Walter Kempees...you are dearly missed. |
 |
 |
Aaron
Posts: 145
|
| Posted: 01/08/2008, 12:22 PM |
|
Good! Glad it worked for you.
|
 |
 |
|