Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <?php
- $result = '';
- $sign = (isset($_REQUEST['sign']))? $_REQUEST['sign'] : '?';
- $firstNumber = (isset($_REQUEST['first']))? $_REQUEST['first'] : '';
- $secondNumber = (isset($_REQUEST['second']))? $_REQUEST['second'] : '';
- if (isset($_REQUEST['sign']) && isset($_REQUEST['first']) && isset($_REQUEST['second'])) {
- switch ($_REQUEST['sign']) {
- case "+":
- $result = $_REQUEST['first'] + $_REQUEST['second'];
- break;
- case "-":
- $result = $_REQUEST['first'] - $_REQUEST['second'];
- break;
- case "*":
- $result = $_REQUEST['first'] * $_REQUEST['second'];
- break;
- case "/":
- $result = $_REQUEST['first'] / $_REQUEST['second'];
- break;
- }
- }
- ?>
- <html lang="ru">
- <head>
- <meta charset="utf-8" />
- <title>Шаблоны страниц</title>
- <link href="css/style.css" rel="stylesheet" type="text/css" />
- </head>
- <body>
- <div id="main">
- <header>
- <h3>Главная</h3>
- <img class="image" src="img/shapka.jpg" alt="" />
- </header>
- <nav>
- <ul>
- <li><a href="index.php" class="active">Главная</a></li>
- <li><a href="pages/page_1.php">Страница 1</a></li>
- <li><a href="pages/page_2.php">Страница 2</a></li>
- </ul>
- </nav>
- <section>
- <section>
- <article>
- <header>
- <h2>
- Тема 1
- </h2>
- </header>
- <p>
- text</p>
- </article>
- <article>
- <header>
- <h2>
- Тема 2</h2>
- </header>
- <form method = "get" action="index.php">
- <p><label for="first"></label>
- <input type = "text" id = "first" name = "first"
- value="<?=$firstNumber?>">
- <?=$sign?>
- <label for="second"></label>
- <input type = "text" id = "second" name = "second"
- value="<?=$secondNumber?>">
- =
- <input type = "text" id = "answer" name = "answer" onkeypress="return false;"
- onmousedown="return false;" style="cursor: default"
- value="<?=$result?>"> </p>
- <br/> <input class="operation" type="submit" name="sign" value = "+">
- <input class="operation" type="submit" name = "sign" value = "-">
- <input class="operation" type="submit" name ="sign" value = "*">
- <input class="operation" type="submit" name ="sign" value = "/">
- </form>
- </article>
- </section>
- <aside>
- <h2>
- News</h2>
- <ul>
- <li><a href="#">New1</a></li>
- <li><a href="#">New2</a></li>
- <li><a href="#">New3</a> </li>
- </ul>
- </aside>
- </section>
- <footer>
- Copyright © 2020 <a href="/" rel="copyright">Localhost</a>.
- This is the module.
- </footer>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement