Advertisement
sanjiisan

Untitled

Apr 5th, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport"
  6. content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  7. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  8. <title>Zadanie 2</title>
  9. <!-- Latest compiled and minified CSS -->
  10. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
  11. </head>
  12. <body>
  13. <div class="container">
  14. <div class="row">
  15. <div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
  16. <form action="page.php" method="get" role="form">
  17. <legend>Pages</legend>
  18. <div class="form-group">
  19. <label for="page">Page number</label>
  20.  
  21. <input type="text" class="form-control" name="page" id="page" placeholder="Page number...">
  22. </div>
  23. <button type="submit" class="btn btn-primary">Send</button>
  24. </form>
  25. </div>
  26. </div>
  27. </div>
  28. </body>
  29. </html>
  30. //////////////
  31. <?php
  32. function getData()
  33. {
  34. if ($_SERVER['REQUEST_METHOD'] === 'GET') {
  35. if (isset($_GET['page'])) {
  36. $number = trim($_GET['page']);
  37.  
  38. for ($i = 1; $i <= floor($number / 2); $i++) {
  39. if ($number % $i === 0) {
  40. echo 'dzielnikiem liczby ' . $number . 'jest: ' . $i . '<br>';
  41. }
  42. }
  43.  
  44. } else {
  45. echo 'Brak danych!';
  46. }
  47. }
  48. }
  49.  
  50. ?>
  51. <!doctype html>
  52. <html lang="en">
  53. <head>
  54. <meta charset="UTF-8">
  55. <meta name="viewport"
  56. content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  57. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  58. <title>Zadanie 2</title>
  59. </head>
  60. <body>
  61. <?php
  62. getData();
  63. ?>
  64. </body>
  65. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement