PHP Drop Down Menu, the Ultimate PHP Drop Down Menu Builder

How to Create a PHP Drop Down Menu?

How to create a PHP drop down menu? The tutorial below shows the operating steps from mySQL database to complete a PHP DHTML menu, here we take Sothink DHTML Menu for example, and please have a check.

Setps to create PHP drop down menu

Sample of PHP drop down menu


Step One

Before creating a PHP DHTML menu, please make a database including the product categories and the specific products:

  1. Create a database named "dmenu" and a database user named "duser" in mySQL
  2. Set the password as 123
  3. Generate tables with codes below:

    CREATE TABLE Category (
    CID int(11) NOT NULL auto_increment,
    Name char(255) DEFAULT '' NOT NULL,
    Notes char(255),
    CREATE TABLE Product (
    PID int(11) NOT NULL auto_increment,
    CID int(11),
    Name char(255) DEFAULT '' NOT NULL,
    Link char(255),
    Notes char(255),

  4. Add a few records to the tables.


Step Two

Create a new menu with Sothink DHTML Menu, click Menu Item > General, select HTML and input <?=$CatName?> in the context box.

PHP Dropdown Menu

Next, click Menu Item > Condition, and input the prefix and suffix there.

Drop Down Menu - Condition

NOTE: Please uncheck "Preview > Enable Auto-Refresh" when creating PHP drop down menus, or you may get a warning because it is the server-side condition code which cannot be processed by the browser directly, but it won’t happens for the PHP drop down menu in a sever-supported PHP page
Tips:To prevent the error popping up, please add the JavaScript comment delimiters /* and */ to Prefix and Suffix:


for ($i = 0; $i < $numrowsCat; $i++)
$rowCat = mysql_fetch_array($resultCat);
$CatName = $rowCat["Name"];



Step Three

Add a sub item, set it as HTML and input <?=$ProName?> in the box, next, input <?=$Link?> in Link field.

Drop Down Menu - General

Click Menu Item> Condition, and input the prefix and suffix there.

Web Menu - Condition

Note: Please do check "This item may be invisible at run-time" when creating the PHP drop down menu, otherwise, the property code would not be referenced and the whole PHP drop down menu would not work correctly.

Sample for a PHP Menu

Click here for the PHP menus ample

PHP Navigation Menu

Observe the PHP menu above, which contains two levels: the parent level showing the product categories and the sub level showing the specific products. Actually, only two menu items are in the PHP drop down menu: one is in the parent level and the other in the sub level.

The final result for the PHP menu is just got from database:


As to the source code of the PHP drop down menu, please check the details here.

  • Sothink DHTML Menu
  • DHTML Menu

  • - Navigate website clearly by PHP drop down menu

  • Create SE friendly PHP drop down menu with ease. 100+ free templates & 30 preset styles help you create professional cross-browser menus in clicks. IE9 beta supported. Menu style can be fully customized. Support making data-base driven navigation bar with ASP, PHP, JSP and more; Seamless integration with almost all web editors, such as DW CS5, FP, EW and Golive. Versatile functional menus like tab menu, multi-column menu, etc.

  • Download (6.20MB)
    30-Day Free Trial
  • Order ($65)
    30 Day Money Back guarantee
Sothink DHTML Menu - Drop down menu


Clean for DHTML Menu 100% Clean - No need to worry about installing unwanted spyware or adware. Uninstallation is completely supported.
Support for DHTML Menu Life-time Free Support - Send an email to our customer service team at whenever you need help.
Guarantee for drop down menu Risk Free Guarantee - Shop safely in our secure online store. Your data and personal information are protected.

Sothink DHTML Menu