Public paste
Undefined
By: Guest | Date: Dec 16 2011 00:22 | Format: PHP | Expires: never | Size: 1.03 KB | Hits: 1450

  1. <?php
  2.  
  3. include("config.php");
  4.  
  5. $sql = "SELECT * FROM faq ORDER BY faqid";
  6. $result = mysql_query($sql) or die(mysql_error());
  7. $faqs = array();
  8. while ($row = mysql_fetch_array($result)) {
  9.     $faqs[] = $row;
  10. }
  11.  
  12. ?>
  13.  
  14. <html>
  15. <script type="text/javascript">
  16.     function Show(id) {
  17.         document.getElementById("mydiv"+id).style.display="inline";
  18.     }
  19.     function Hide(id) {
  20.         document.getElementById("mydiv"+id).style.display="none";
  21.     }
  22. </script>
  23. <body>
  24.  
  25. <?php
  26.     if (!empty($faqs)) {
  27.         foreach ($faqs as $row) {
  28.             $id = $row['faqid'];
  29.             ?>
  30. <a href="#" onclick="Show(<?php echo $id ?>);" ><?php echo $row['ftitle'];?></a><br/>
  31. <div id="mydiv<?php echo $id ;?>" style="display:none;" onmouseover="Show(<?php echo $id ?>);">
  32. <div class="note"><?php echo $row['faqtext'];?> </div><a href="#" onclick="Hide(<?php echo $id ?>);" onmouseout="Hide(<?php echo $id ?>);" > Hide</a>
  33. <br />
  34. </div>
  35.             <?php
  36.         }
  37.     }
  38. ?>
  39. </body>
  40. </html>