ALERT!
Click here to register with a few steps and explore all our cool stuff we have to offer!
Home
Upgrade
Credits
Help
Search
Awards
Achievements
 15864

PHP Calculator Template

by Nord - 12-03-2015 - 01:09 AM
#1
Hello :D,
Today i made a php calculator on the website c9 and if you would like to make any edits to it please do

----Code----
(Index.php)

<!DOCTYPE html>
<html>
    <head>
        <title>Nord From DF</title>
        <link rel="stylesheet" href="main.css">
    </head>
    <body>
        <div id="container">
            <div id="head">
                Nord Was Here
            </div>
            <div id="main">                 
               <form action="capture.php" method="get">
      <select name="x">
          <?php
          for ($x = 0; $x <= 99; $x++) {
              echo "<option value=$x>$x</option>";
          }
          ?>
</select>
      <select name="y">
  <option value="1">/</option>
  <option value="2">*</option>
  <option value="3">-</option>
  <option value="4">+</option>
</select>
      <select name="z">
          <?php
          for ($z = 0; $z <= 99; $z++) {
              echo "<option value=$z>$z</option>";
          }
          ?>
</select>
                   <input type="submit">
                  
               </form>
               
            </div>
        </div>
    </body>
</html>

(Capture.php)

<!DOCTYPE html>
<html>
    <head>
        <title>PHP Tutorials</title>
        <link rel="stylesheet" href="main.css">
    </head>
    <body>
        <div id="container">
            <div id="head">
                PHP Tutorials
            </div>
            <div id="main"> 
            <?php
            $x = $_GET["x"];
            $y = $_GET["y"];
            $z = $_GET["z"];
            
            switch ($y) {
                case 1:
                    echo $x / $z;
                    break;
                case 2:
                    echo $x * $z;
                    break;
                case 3:
                    echo $x - $z;
                    break;
                case 4:
                    echo $x + $z;
                    break;
            }

            ?>

            </div>
        </div>
    </body>
</html>

(main.css)

body{
    font-family: Verdana, Geneva, sans-serif;
    background-color: #5DBB6D;
    font-size: 18px;
    color: #3A3435;
}
#container{
    width: 600px;
    margin: auto;
    background-color: #F3DBA9;
    border:3px solid #DD4730;
}
#head{
    background-color: #DD4730;
    padding: 15px;
    font-size: 200%;
    text-align: right;
    color: #F3DBA9;
    border-bottom:3px solid #DD4730;
}
#main{
    min-height:400px;
    padding: 15px;
}
Reply
#2
jesus nice release!
/2020
Reply
#3
(12-03-2015 - 05:34 AM)xblz Wrote: Mind sharing the "main.css" you supposedly made? Alongside the "capture.php" and if it requires GET / POST. Would be nice to see the FULL source.

i have ::D if you read the thread i have split  the by (index.php, Capture.php and then main.css)
Reply
#4
i was looking for this thank you for sharing php calculator template
Reply
#5
Suggestion 1: Use PHP tags
TIP: Add modules.  "%"

Nice source, easy to make however.
Reply
#6
i was looking the code thank you :)
Reply
#7
Good share. Thanks
Reply
#8
Good very thank you
Reply
#9
will this work with IIS?
Reply
#10
Thanks for sharing this nice peace of code :)
Reply

Users browsing: 1 Guest(s)