SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Threaded View

  1. #1
    Web Enthusiast
    Join Date
    Jul 2000
    Location
    Western Massachusetts, USA
    Posts
    1,389
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    need script for db driven drop-down menu

    I want to create a horizontal series of drop-down menus whose sub-items are db driven. Here is the PHP script for one of the menu items in the series.
    PHP Code:
    <ul>
      <li><a href="#">programs</a> 
        <ul>
          <?php
    //navigation to program categories 11/26/07
    $links_prog_cats = @mysql_query("SELECT DISTINCT id, name FROM category_programs WHERE site_id='$site_id' AND visible = 'Y' ORDER BY order_cat"); 
    if (!
    $links_prog_cats) {
      exit(
    '<p>Error retrieving links from database!<br />'.
          
    'Error: ' mysql_error() . '</p>');
        }
    //end if !links
    while ($prog_cat mysql_fetch_array($links_prog_cats)) {
      
    $c_id $prog_cat['id'];
      
    $name_cat htmlspecialchars($prog_cat['name_cat']);
      echo 
    "<li>";
      echo 
    "<a href='cat_prog/$site_address/$c_id'>$name_cat</a></li>;\n";
      }
    //end while categories
      
    ?>
        </ul>
      </li>
    </ul>
    Suggestions?
    Last edited by paulcj2; Nov 26, 2007 at 19:38. Reason: additional info
    Paul C.
    ClickBasics
    http://www.clickbasics.com


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •