Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <input type="submit" name="dodaj(1)" value="1" />
- <input type="submit" name="dodaj(2)" value="2" />
- <input type="submit" name="3" value="3" /></br>
- <input type="submit" name="4" value="4" />
- <input type="submit" name="5" value="5" />
- <input type="submit" name="6" value="6" /></br>
- <input type="submit" name="7" value="7" />
- <input type="submit" name="8" value="8" />
- <input type="submit" name="9" value="9" /></br>
- <input type="submit" name="+" value="+" />
- <input type="submit" name="-" value="-" />
- <input type="submit" name="*" value="*" />
- <input type="submit" name="/" value="/" />
- <form action="" method="POST" >
- <input type="text" name="oblicz" id="oblicz" /></br>
- <input type="submit" value="Policz" />
- </form>
- <script>
- function dodaj(
- var element = document.getElementById("demo");
- </script>
- <?php
- function calculate_string( $mathString ) {
- $mathString = trim($mathString); // biale znaki
- $mathString = preg_replace('[^0-9\+-\*\/\(\) ]', '', $mathString);
- // usun operatora
- $compute = create_function("", "return (" . $mathString . ");" );
- return 0 + $compute();
- }
- $string = $_POST['oblicz'];
- echo calculate_string($string);
- ?>
- <html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement