473,326 Members | 2,173 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Dynamic DropDown Menu in PHP

5
Hi,

I was wondering if it's possible to create a dynamic dropdown menu from this code.

Expand|Select|Wrap|Line Numbers
  1. if($rs->getNumRows() > 0){
  2.                     $intProjectCount = 1;
  3.                     $htmlOut ="<table width='100%'  border='0' align='center' cellpadding='1' cellspacing='0'>";
  4.                     foreach($rs->fetch() as $prs){
  5.  
  6.                         $htmlOut .="<tr><td class=\"projectkiri\" ><a href=\"/index.php?page=PROJECTS&id=".$prs['pr_ID']."\">".$prs[$strFieldName]."</a></td></tr>";
  7.                         //$intProjectCount++;
  8.                     }
  9.                      $htmlOut .="</table>";
  10.                 }else{
  11.                     $htmlOut ="<table width='100%'  border='0' align='center' cellpadding='1' cellspacing='0'>";
  12.                     $htmlOut .="<tr>
  13.                             <td class='projectkiri'>Belum ada proyek <br>untuk saat ini</td>
  14.                           </tr>
  15.                         </table>";
Basically, if I understood this correctly, this snippet of code
Expand|Select|Wrap|Line Numbers
  1.                         $htmlOut .="<tr><td class=\"projectkiri\" ><a href=\"/index.php?page=PROJECTS&id=".$prs['pr_ID']."\">".$prs[$strFieldName]."</a></td></tr>";
makes sure the "projectkiri" (project-menu on the left of the page) is displayed. Meaning the different projects listed in the CMS. Now, as it's 5 projects, I want that as soon as you mousehover above the selected project, a sub-menu consisting of 4 different submenus to appear (We've already got the sub-pages incorporated, I just want a sub-menu for easier access).

So hover above project 1, the four sub-menus for project 1 appear, same for project 2 etc.. Is this actually possible? I tried it myself but somehow the dropdown menus didn't appear when you mouse-over'd but they were constantly there. Also when I used <ul> and <il> tags in the $htmlOut I kept getting a parse/syntax error everywhere.

Thanks in advance.
Jun 24 '09 #1
1 2638
dlite922
1,584 Expert 1GB
@sydd
This is a CSS issue. The mouseover event and the display format/behaviors of the page are controlled on the client side. PHP uses the server to output browser code (HTML, JavaScript, CSS, etc).

I'm assuming you have for menu items (4 projects let's say) and when you mouse over each project menu, a drop down list of sub-items for that project should appear?

If this is correct, than you need a dynamic drop down menu. There are many codes online if you don't want to create your own. Once you have that, you echo the values of the items with PHP.

Hope that makes sense to you,




Dan
Jun 24 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: jorntk | last post by:
How can i make a drop down menu that are dynamiclly generated base on the value selected in another drop down menu? thanks nad regards Jorn
1
by: Andrea Bampi | last post by:
I'm just trying to do my first experiments with js, but I need some good examples to start with.. I need to design a dynamic form with two dropdown menus picking their select values from a db: my...
3
by: Robert Mark Bram | last post by:
Hi All! Has anyone seen an example of the following javascript powered control: - a dropdown select menu - the width of the control is set. Assume by "control" I mean the visible part of the...
7
by: Bertman105 | last post by:
Hey all, Heres the situation: I have a form page that needs to have multiple drop down menus that is pulling their options from a database. Right now I have one working out of 3. So that is one...
0
by: Just Me | last post by:
My Dynamic dropdown menus are appearing above the text below. How can I prevent this, I have tried setting the zorder high for them, but it makes not difference. Cheers
4
torquehero
by: torquehero | last post by:
Hi all :) I have created a horizontal navbar using Xara Menumaker. The Menu items have several dropdown menus. Its a javascript. When the mouse cursor is moved over any menu item, a dropdown...
2
by: William Youngman | last post by:
We are developing an application that presents data to the user in a gridview and we are using the dropdown extender to give the user a SharePoint 2007 type dropdown menu attached to the cells of a...
1
by: Steve Richter | last post by:
I am using <div align=centerto center a horizontal menu on the page. Problem is the center align of the div is rippling down to the menu items and causing the text of the dynamic popup sub menu...
1
by: phpnewbie2007 | last post by:
I have 2 dynamic PHP dropdowns: The second dropdown populates from the first, depending on what is selected in the first. The page is showing issues in a department: The first dropdown...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.