Public paste
Undefined
By: Guest | Date: Dec 16 2011 00:20 | Format: PHP | Expires: never | Size: 1.07 KB | Hits: 1419

  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. $id = $row['faqid'];
  13.  
  14. ?>
  15.  
  16. <html>
  17. <script type="text/javascript">
  18.     function Show(id) {
  19.         document.getElementById("mydiv"+id).style.display="inline";
  20.     }
  21.     function Hide(id) {
  22.         document.getElementById("mydiv"+id).style.display="none";
  23.     }
  24. </script>
  25. <body>
  26.  
  27. <?php
  28.     if (!empty($faqs)) {
  29.         foreach ($faqs as $row) {
  30.             ?>
  31. <a href="#" onclick="Show(<?php echo $row['faqid']; ?>);" ><?php echo $row['ftitle'];?></a><br/>
  32. <div id="mydiv<?php echo '.$id.';?>" style="display:none;" onmouseover="Show(<?php echo $row['faqid']; ?>);">
  33. <div class="note"><?php echo $row['faqtext'];?> </div><a href="#" onclick="Hide(<?php echo $row['faqid']; ?>);" onmouseout="Hide(<?php echo $row['faqid']; ?>);" > Hide</a>
  34. <br />
  35. </div>
  36.             <?php
  37.         }
  38.     }
  39. ?>
  40. </body>
  41. </html>