Guest User

Untitled

a guest
Oct 22nd, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.67 KB | None | 0 0
  1. <?php require_once ("includes/session.php")?>
  2. <?php confirm_logged_in()?>
  3. <?php require_once ("includes/connection.php")?>
  4. <?php include ("includes/header.php")?>
  5. <?php include ("includes/navigation.php")?>
  6.  
  7. <p><h2>Zine DB Archives</h2></p>
  8. <script type="text/javascript" src="includes/script.js"></script>
  9. <table width="100%" cellpadding="5">
  10.     <form action="" method="POST">
  11.             <center>
  12.                 <select name="issueSelect">
  13.                     <?php
  14.                         //Generating the drop-down list for the magazine issues.
  15.                         try
  16.                         {
  17.                             $query = $dbh->prepare ("SELECT * FROM `ZineDB`.`Magazine`");
  18.                             $query->execute ();
  19.                         }catch (PDOException $pdoe) {
  20.                             echo $pdoe->getMessage();
  21.                         }
  22.                         $result = $query->fetchAll();
  23.                         //Populate.
  24.                         foreach ($result as $index => $row) {
  25.                             echo "<option value=\"{$row["Issue"]}\">{$row["Issue"]}</option>";
  26.                         }
  27.                     ?>
  28.                 </select>
  29.             <input type="submit" name="issue" value="Issue"/>
  30.            
  31.                 <select name="authorName">
  32.                     <option value="authorOption" selected="selected">Search by author...</option>
  33.                     <?php
  34.                         //Generating the drop-down list for article authors.
  35.                         try
  36.                         {
  37.                             $query = $dbh->prepare ("SELECT DISTINCT(Author) FROM `ZineDB`.`Article`");
  38.                             $query->execute ();
  39.                         }catch (PDOException $pdoe) {
  40.                             echo $pdoe->getMessage();
  41.                         }
  42.                         $result = $query->fetchAll();
  43.                         //Populate.
  44.                         foreach ($result as $index => $row) {
  45.                             echo "<option value=\"{$row["Author"]}\">{$row["Author"]}</option>";
  46.                         }
  47.                     ?>
  48.                 </select>
  49.             <input type="submit" name="Author" value="Author"/>
  50.            
  51.             <select name="topicName">
  52.                     <option value="articleTypeOption" selected="selected">Search by article type...</option>
  53.                     <?php
  54.                         //Generating the drop-down list for article topics.
  55.                         try
  56.                         {
  57.                             $query = $dbh->prepare ("SELECT DISTINCT(Topic) FROM `ZineDB`.`Article`");
  58.                             $query->execute ();
  59.                         }catch (PDOException $pdoe) {
  60.                             echo $pdoe->getMessage();
  61.                         }
  62.                         $result = $query->fetchAll();
  63.                         foreach ($result as $index => $row) {
  64.                             echo "<option value=\"{$row["Topic"]}\">{$row["Topic"]}</option>";
  65.                         }
  66.                     ?>
  67.                 </select>
  68.             <input type="submit" name="Topic" value="Topic"/></center>
  69.        
  70.             <br/><br/>
  71. <!--            Allowing for search by text.-->
  72.             <center><input type="text" name="byText" class="reqd" value="Search by text"/>
  73.                 </br>
  74.             <input type="submit" name="Text" value="Search"/></center>
  75.     </form>
  76. </table>
  77. <br/>
  78.  
  79. <?php
  80.     if ($_POST["issue"] && !empty($_POST["issueSelect"]))
  81.     {
  82.         header ("Location: magazine_pages.php?issue=" . urlencode($_POST["issueSelect"]));
  83.         exit;
  84.     }
Add Comment
Please, Sign In to add comment