Skip to main content
Code Review

Return to Revisions

2 of 2
replaced http://stackoverflow.com/ with https://stackoverflow.com/

This is going to have a lot of extensibility concerns. What if I want to add exponentials or scientific notation? What if I want to chain operations? What if I want to ensure someone doesn't put unsafe code that could bork my webserver in the POST variable?

https://stackoverflow.com/questions/2401706/where-to-sanitize-php-post-input

All that said, I'm impressed by how good a job you did of separating your presentation from your business logic. I've seen a lot uglier PHP. The main page code is nicely mainly HTML, and the business logic is separated out.

From here, POA:

  1. Refactor for an Object Oriented Approach

  2. Sanitize User input

  3. Consider breaking apart pieces of the UI into separate chunks that are added dynamically, which reduced the maintenance burden. For example, you may want to put

     Select an arithmetic operator: <br />
     <select name="field3">
     <option value="">Please select an option</option>
     <?php
     echo myselect();
     ?>
     </select>
    </div>
    

In an operations.php that you include. This allows for easy modification/adding of stuff later.

Also, you'll probably want to look into AJAX.

default

AltStyle によって変換されたページ (->オリジナル) /