Пример #1
0
         
         <input style="margin-left: 115px;" type="submit" value="Add FAQ" />
         	
     </form>
     <?php 
     }
 } elseif ($_GET['do'] == 'edit-faq') {
     ?>
         <p>Here you can edit existing frequently asked questions.</p>
         <?php 
     if ($_SERVER['REQUEST_METHOD'] == "POST") {
         $fails = 0;
         $i = 0;
         while (count($_POST['faq_id']) > $i) {
             //echo "\n ID: " . $_POST['announcement_id'][$i] . "\nTYPE: " .$_POST['announcement_type'][$i] . "\n TEXT: " . $_POST['announcement_text'][$i++] . "\n";
             if (!$faq->updateFAQ($_POST['faq_id'][$i], $_POST['faq_question'][$i], $_POST['faq_answer'][$i++])) {
                 $fails++;
             }
         }
         if ($fails == 0) {
             echo '<p class="notification green">You have successfully updated the existing frequently asked questions.</p>';
             $log->addLog($_SESSION['loggedIn']['id'], "Updated frequently asked questions.");
             $hideForm = true;
         } else {
             echo '<p class="notification red">Something went wrong while updating the frequently asked questions.</p>';
         }
     }
     if ($hideForm !== true) {
         ?>
         <form action="" method="post" class="styled">
         <table width="100%">