CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Update question

Print topic Send  topic

Author Message
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.
View profile  Send private message
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.
View profile  Send private message
ckroon

Posts: 869
Posted: 01/06/2008, 12:45 PM

Thanks Aaron!
Worked great! :-D
_________________
Walter Kempees...you are dearly missed.
View profile  Send private message
Aaron


Posts: 145
Posted: 01/08/2008, 12:22 PM

Good! Glad it worked for you.
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.