Advertisement
Venciity

Sidebar Builder

Aug 21st, 2014
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.68 KB | None | 0 0
  1. <!doctype html>
  2. <?php
  3. if (isset($_POST['categories']) && isset($_POST['tags']) && isset($_POST['months'])) {
  4.     $categories = $_POST['categories'];
  5.     $categoriesArray = explode(", " , $categories);
  6.     $tags = $_POST['tags'];
  7.     $tagsArray = explode(", ", $tags);
  8.     $months = $_POST['months'];
  9.     $monthsArray = explode(", ", $months);
  10. }
  11. ?>
  12. <html lang="en">
  13. <head>
  14.     <meta charset="UTF-8">
  15.     <title>Sidebar Builder</title>
  16. </head>
  17. <body>
  18. <form action="" method="post">
  19.     <label for="categories">Categories : </label>
  20.     <input type="text" name="categories" id="categories"/>
  21.     <br/>
  22.     <label for="tags">Tags : </label>
  23.     <input type="text" name="tags" id="tags"/>
  24.     <br/>
  25.     <label for="months">Months : </label>
  26.     <input type="text" name="months" id="months"/>
  27.     <br/>
  28.     <input type="submit" value="Generate"/>
  29. </form>
  30. <div id="result">
  31.     <?php
  32.     if (isset($categoriesArray)) {
  33.         echo "<div>";
  34.         echo "<h1>Categories</h1>";
  35.         echo "<ul>";
  36.         foreach ($categoriesArray as $category) {
  37.             echo "<li>$category</li>";
  38.         }
  39.         echo "</ul>";
  40.         echo "</div>";
  41.         }
  42.  
  43.     if (isset($tagsArray)) {
  44.         echo "<div>";
  45.         echo "<h1>Tags</h1>";
  46.         echo "<ul>";
  47.         foreach ($tagsArray as $tag) {
  48.             echo "<li>$tag</li>";
  49.         }
  50.         echo "</ul>";
  51.         echo "</div>";
  52.     }
  53.  
  54.     if (isset($monthsArray)) {
  55.         echo "<div>";
  56.         echo "<h1>Month</h1>";
  57.         echo "<ul>";
  58.         foreach ($monthsArray as $month) {
  59.             echo "<li>$month</li>";
  60.         }
  61.         echo "</ul>";
  62.         echo "</div>";
  63.     }
  64.     ?>
  65. </div>
  66. </body>
  67. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement