Wap Calc

Started on the old forum in May 2007 · view the original in the archive · old links redirect here

1 reply · 449 views · started 19 years ago · 1 min read

2 participants
WhiteWarrior Principal · 1,419 posts #1

create file calc.php and put...

CODE<?php /////////////calc/////////////////////// /////Mailto:dwizofoz19@yahoo.co.uk//////// header("Content-type: text/vnd.wap.wml"); echo "<?xml version=\"1.0\"?>"; echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\"" . " \"http://www.wapforum.org/DTD/wml_1.1.xml\">"; ?> <wml>

<?php if ($action=="") { echo "<card id=\"card1\" title=\"Calculator\">"; echo " "; echo "**Calculator** "; echo "Enter Value: "; echo "<input emptyok=\"true\" name=\"no\" format=\"*n\" maxlength=\"255\" size=\"4\"/>"; echo ""; echo " <anchor title=\"Square Root\">Square Root"; echo "<go href=\"calc.php?action=sqrt\" method=\"post\">"; echo "<postfield name=\"no\" value=\"\$no\"/>"; echo "</go>"; echo "</anchor>"; echo " <anchor title=\"Cosine\">Cosine"; echo "<go href=\"calc.php?action=cosine\" method=\"post\">"; echo "<postfield name=\"no\" value=\"\$no\"/>"; echo "</go>"; echo "</anchor>"; echo " <anchor title=\"Sine\">Sine"; echo "<go href=\"calc.php?action=sine\" method=\"post\">"; echo "<postfield name=\"no\" value=\"\$no\"/>"; echo "</go>"; echo "</anchor>"; echo " <anchor title=\"Tangent\">Tangent"; echo "<go href=\"calc.php?action=tangent\" method=\"post\">"; echo "<postfield name=\"no\" value=\"\$no\"/>"; echo "</go>"; echo "</anchor>"; echo " **Other Calcs:** "; echo "<a href=\"calc.php?action=areacalc\">Area Calculator</a> "; echo "<a href=\"calc.php?action=hypotcalc\">Hypotenuse Calculator</a>"; echo ""; echo " **© DrugsBunny**"; echo " <a title=\"Enter\" href=\"welcome.php?username=$username&amp;password=$password\">Main Menu</a>"; echo " "; echo " "; echo "</card>"; } ///////////////////////////////Square Root////////////////// if ($action=="sqrt") { $no=$_POST["no"]; echo "<card id=\"card1\" title=\"Calculator\">"; echo "Square Root of $no is "; echo sqrt($no); echo "</card>"; } ///////////////////////////////Cosine////////////////// if ($action=="cosine") { $no=$_POST["no"]; echo "<card id=\"card1\" title=\"Calculator\">"; echo "Cosine of $no is "; echo cos($no); echo "</card>"; } ///////////////////////////////Sine//////////////////// if ($action=="sine") { $no=$_POST["no"]; echo "<card id=\"card1\" title=\"Calculator\">"; echo "Sine of $no is "; echo sin($no); echo "</card>"; } /////////////////////////////Tangent///////////////////// if ($action=="tangent") { $no=$_POST["no"]; echo "<card id=\"card1\" title=\"Calculator\">"; echo "Tangent of $no is "; echo tan($no); echo "</card>"; } ///////////////////////////Area Calcs//////////////////// if ($action=="areacalc") { echo "<card id=\"card1\" title=\"Area Calc\">"; echo " "; echo "<a href=\"calc.php?action=squarearea\">Square</a> "; echo "<a href=\"calc.php?action=rectanglearea\">Rectangle</a> "; echo " "; echo "</card>"; } /////////////////////////Square area////////////////// if ($action=="squarearea") { echo "<card id=\"card1\" title=\"Area Calc\">"; echo " "; echo "**Enter side:** <input emptyok=\"true\" name=\"sqside\" format=\"*n\"/> "; echo "<anchor title=\"Go\">Go"; echo "<go href=\"calc.php?action=squarearea2\" method=\"post\">"; echo "<postfield name=\"sqside\" value=\"\$(sqside)\"/>"; echo "</go>"; echo "</anchor>"; echo " "; echo "</card>"; } if ($action=="squarearea2") { echo "<card id=\"card1\" title=\"Area Calc\">"; echo " "; $sqside=$_POST["sqside"]; $area=$sqside * $sqside; echo "Area of square is:**$area** units"; echo " "; echo "</card>"; } ///////////////////////Rectangle area////////////////// if ($action=="rectanglearea") { echo "<card id=\"card1\" title=\"Area Calc\">"; echo " "; echo "**Enter length:** <input emptyok=\"true\" name=\"rcl\" format=\"*n\" size=\"4\"/> "; echo "**Enter width:** <input emptyok=\"true\" name=\"rcw\" format=\"*n\" size=\"4\"/> "; echo "<anchor title=\"Go\">Go"; echo "<go href=\"calc.php?action=rectanglearea2\" method=\"post\">"; echo "<postfield name=\"rcl\" value=\"$(rcl)\"/>"; echo "<postfield name=\"rcw\" value=\"$(rcw)\"/>"; echo "</go>"; echo "</anchor>"; echo " "; echo "</card>"; } if ($action=="rectanglearea2") { $rcl=$_POST["rcl"]; $rcw=$_POST["rcw"]; $rectarea=$rcl * $rcw; echo "<card id=\"card1\" title=\"Area Calc\">"; echo " "; echo "Area of rectangle is:**$rectarea** units"; echo " "; echo "</card>"; } /////////////////////Hypot calc/////////////////////////// if ($action=="hypotcalc") { echo "<card id=\"card1\" title=\"Hypotenuse Calc\">"; echo " "; echo "**X side:** "; echo "<input emptyok=\"true\" name=\"a\" size=\"4\"/> "; echo "**Y side:** <input emptyok=\"true\" name=\"b\" format=\"*n\" size=\"4\"/> "; echo "<anchor title=\"Get hypotenuse\">Get hypotenuse"; echo "<go href=\"calc.php?action=hypotcalc2\" method=\"post\">"; echo "<postfield name=\"a\" value=\"$(a)\"/>"; echo "<postfield name=\"b\" value=\"$(![](http://www.2wap.org/forums/style_emoticons/<#EMO_DIR#>/cool.gif)\"/>"; echo "</go>"; echo "</anchor>"; echo " "; echo "</card>"; } if ($action=="hypotcalc2") { $a=$_POST[a]; $b=$_POST; $c=hypot($a,$b); echo "<card id=\"card1\" title=\"Hypotenuse Calc\">"; echo " "; echo "The hypotenuse of ($a,$b) is $c"; echo " "; echo "</card>"; } ?> </wml>

then upload to your server then add the calc.php to your script. External image (may be gone) works with all scripts... enjoy

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close