Old 12-13-2007   #1 (permalink)
Registered User
 
Join Date: Aug 2004
Posts: 105

THe calculator issue

Shame you closed the thread.... kind of silly actually.
You're original issue was a malformed switch in calculate.php

You forgot to break each case.

Proper switch (which works)
PHP Code:
<?php
#BEGIN Variable Declarations & Initializations.
$First_Integer $_POST['First_Field'];
$Operator $_POST['Operation_Field'];
$Second_Integer $_POST['Second_Field'];
#END Variable Declarations & Initializations.

switch ($Operator) {
#If $Operator is equal to "/" then divide $First_Integer by $Second_Integer.
case "/":
$result $First_Integer $Second_Integer;
break;

#If $Operator is equal to "*" then multiply $First_Integer by $Second_Integer.
case "*":
$result $First_Integer $Second_Integer;
break;

#If $Operator is equal to "-" then subtract $Second_Integer from $First_Integer.
case "-":
$result $First_Integer $Second_Integer;
break;

#If $Operator is equal to "+" then add $First_Integer and $Second_Integer.
case "+":
$result $First_Integer $Second_Integer;
break;
}

echo 
$result;
?>

I post this in case someone else runs across the thread and wants a solution since you did not post a solution yourself.

FYI.. I before E except after C.
Jolt is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT +1. The time now is 08:59 PM.
Content Relevant URLs by vBSEO 3.2.0 RC7

Design & Content © BioRUST 2007 :: PRIVACY STATEMENT :: LEGAL INFORMATION :: ADVERTISING MEDIA KIT