Advertisement
Guest User

Untitled

a guest
Mar 8th, 2017
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 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>Document</title>
  9. </head>
  10. <body>
  11.  
  12.  
  13. <?php
  14.  
  15. if (isset($_GET['categories']) && isset($_GET['tags']) && isset($_GET['months'])
  16. && isset($_GET['categories']) != '' && isset($_GET['tags']) != '' && isset($_GET['months']) != ''){
  17. $categories = $_GET['categories'];
  18. $tags = $_GET['tags'];
  19. $months = $_GET['months'];
  20.  
  21. $categories = array_map('trim', explode(', ', $categories));
  22. $tags = array_map('trim', explode(', ', $tags));
  23. $months = array_map('trim', explode(', ', $months));
  24.  
  25.  
  26. $html = "<h2>Categories</h2><ul>" . printArray($categories);
  27. echo $html;
  28.  
  29. $html1 = "<h2>Tags</h2><ul>" . printArray($tags);
  30. echo $html1;
  31.  
  32. $html2 = "<h2>Months</h2><ul>" . printArray($months);
  33. echo $html2;
  34.  
  35.  
  36. }
  37.  
  38. function printArray(array $arr)
  39. {
  40. $html = '';
  41. foreach ($arr as $item) {
  42. $html .= "<li>$item</li>";
  43. }
  44. $html .= "</ul>";
  45.  
  46. return $html;
  47. }
  48.  
  49.  
  50.  
  51. ?>
  52.  
  53.  
  54. <form>
  55. Categories:<input type="text" name="categories" /> <br />
  56. Tags: <input type="text" name="tags" /> <br />
  57. Months: <input type="text" name="months" /> <br />
  58. <input type="submit" value="Generate" name="generate" />
  59. </form>
  60.  
  61.  
  62. </body>
  63. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement