drop down menu read from mysql

Discussion in 'PHP' started by legend19892008, Jun 30, 2008.

  1. #1
    plz i want to make a drop down menu that read from database,i want categories appear and the brands appear inside
     
    legend19892008, Jun 30, 2008 IP
  2. Vooler

    Vooler Well-Known Member

    Messages:
    1,146
    Likes Received:
    64
    Best Answers:
    4
    Trophy Points:
    150
    #2
    Ok, that is possible, are the categories in hierarchical presentation or all in same place. A simple example would be.

    $combo = "<select name=\"category\">";
    $res = mysq_query("SELECT * FROM categories ORDER BY category_title");
    while($cat = mysql_fetch_assoc($res)) {
        $combo .= "<option value=\"$cat[category_id]\">$cat[category_title]</option>";
    }
    $combo .= "</select>";
    
    print $combo;
    
    PHP:
    I hope it helps.

    regards
     
    Vooler, Jun 30, 2008 IP
  3. legend19892008

    legend19892008 Peon

    Messages:
    34
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    no i want it drop down menu
    as in dynamic drive
     
    legend19892008, Jun 30, 2008 IP
  4. Vooler

    Vooler Well-Known Member

    Messages:
    1,146
    Likes Received:
    64
    Best Answers:
    4
    Trophy Points:
    150
    #4
    Show me one example, and we will try poplating it with your database enteries.

    regards
     
    Vooler, Jun 30, 2008 IP
  5. legend19892008

    legend19892008 Peon

    Messages:
    34
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    legend19892008, Jul 2, 2008 IP