Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




PHP / Javascript Menu List Population


I would like a web page to have 2 menu lists

The contents of the second menu list depending on the selection made in
the first.

The contents of the second would be populated from a database.

I am fairly new to programming using PHP, Javascript and MySQL but I am
sure what I am asking has been done before. Could someone please give
me some pointers or direct me to a tutorial.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Multi Drop Down Menu Population
I am having problems getting the 3rd and 4th drop downs to work properly. What am I doing wrong? Also is there an easier way to do this using one table insead of multiple SQL tables? Code:

Population Select Menu Using Php And Database Values
I have no idea how to go about this. so i would apreciate some help i want to populate the values in a html select menu from database values in one table

so i want all the values from 1 particular field in the database to be displayed in the select menu as separate options.

Dynamic List Population
how do you populate a list dynamically? for example I have the following in a table but I can't get them into the list after the query is performed.

<form action="">
<select name="cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="fiat">Fiat</option>
<option value="audi">Audi</option>
</select>

Echoing Value To List Menu
Hi, I was wondering can I echo out value from db to list menu and how?

List Menu Choices?
Why does Multiple Choice List only report 1 value? i got a normal form: Code:

Can You Read A Value Into A List Menu?
a system i am developing has both a user and an admin side. The user can add a record and then the status of this is initially set to a fixed value.

What I am wondering is, if i stick with a list of say 4 possible status', how can i get whatever status the admin changes the record to to be "sticky" on the menu the next time he looks at the call, as opposed to the menu showing the default value set in dreamweaver?

Select List/Menu Using PHP And MYSQL
Here is my code:

<select name="country" class="sidelinks">
<?php
do
{
?>
<option value="<?php echo $row_AllCountries['country_ID']." ";?>"<?php if ($row_AllCountries['country_ID'] = $acountry) { echo "selected"; }?> >
<?php echo $row_AllCountries['countryname'];?></option>
<?php
}
while ($row_AllCountries = mysql_fetch_assoc($AllCountries));
?>
</select>

A few words to describe:
-$row_AllCountries['country_ID'](get from MySQL) is a unique country ID number
-$row_AllCountries['countryname'](get from MySQL) is the name of the country
-$acountry is the country ID number that i want to be selected when the form loads

I have all the values and country names named OK...the only problem is that when the form loads it selects the last country.

Adding Items To A List Or Menu
Not sure if it is a php question but since i am working in php here it is.

Ho can i add items to (the item label=visual text and the value=index
number) a list object on a website.

I am having a list with 4 items and i would like to add the text from a
textfield (textfield1.value) to the list object so it will hold 5 items.

Change List View To Dropdown Menu
Im working on a script that has to be change so a user can choose from a dropdown menu instead of a list that now is displayed.
Here is the part that is insert on the index page.

Creating Simple Unordered List Menu From XML?
Does anyone have any examples or links to examples of generating a
simple unordered list menu with multiple levels from an XML file? We
are redesigning the navigation on our website and I was hoping to make
this as flexible as possible.


Long Strings In List/menu Boxes
Is there a way to get a list/menu box to resize as the page is resized and
for any long string that is an item in the list to be spread over two or
more lines in the same way as text in a table does.

Flat File List Style Menu
I'm trying to build a Menu Building out of flatfiling with a section to add new areas to it.  The idea behind it is to have a header for each section (as the top order list item) then each one below is a link of that category.

I already figured I'm buillding it with limits (20 items Max per heading) and that to do it I will simply have each Heading/links in it be a new row in the document.  example row Tips tips.php Tips on Php, file tips File Tips tips/files.php, etc etc

With the first item of each row being the Heading and each other being the ones under it My question is What delimiters should I use to seperate in the row (I need to separate each item by 1 delimiter and then in each row separate the href, alt, name)

Secondly for rewrtiign it should I simply write it so each time it rewrites the whole file or should  I try and do string replacing and do modify sorta deal.

Print Array In List/menu Form Object
how i print a full column array into a list/menu form object, so that the text links to their respective page.....it is basically for a list of interviews so you click on the band name and then goto the interview page.

Form Field Dynamic Population And PHP
I have a form that dynamically generates a drop down from a table column called suppliers.

Products supplied by each supplier vary so what I want to try and achieve is that once a supplier has been selected a second drop down on the same page is populated with data from the same table / different column with that suppliers products.
(I am trying to avoid refreshing the page)

I have not supplied any code at this stage as I am not sure whether PHP is capable of doing this by itself or whether javascript would need to be incorporated.

Multiple Dynamic Drop Down Population
I have a table with 3 pieces of data that I would like to use to
dynamically populate 3 drop downs using javascript. The fields are
state, orgname, office. If it's not already obvious, I'd like orgname
drop down to change when a state is selected and I would like office
drop down to change when an orgname is selected. I can do this with
multiple tables but am having difficulty getting it to work when the
data is in the same table. Below is the code to get state and orgname
from separate tables(the code reflects one table and is broken in the
below state). It's the best I can come up with and I can see why it
doesn't work but I know there must be a way to pull all the pieces from
a single table.

<code>
$list=$_SESSION['list'];
if(isset($list) and strlen($list) 0){
$quer=mysql_query("SELECT DISTINCT orgname,org_id FROM organization
WHERE state=$list ORDER BY orgname");
}else{$quer=mysql_query("SELECT DISTINCT orgname FROM organization ORDER
BY orgname"); }
$quer2=mysql_query("SELECT DISTINCT state FROM organization ORDER BY
state");

//first drop down
echo "<select name='state' onchange="reload(this.form)"><option
value=&#390;'>Select one</option>";
while($state = mysql_fetch_array($quer2)) {
if($state['org_id']==@$list){echo "<option selected
value='$state[state]'>$state[state]</option>"."<BR>";}
else{echo "<option value='$state[state]'>$state[state]</option>";}
}
echo "</select>";

//next drop down
echo "<select name='org'><option value=''>Select one</option>";
while($org = mysql_fetch_array($quer)) {
echo "<option value='$org[org_id]'>$org[orgname]</option>";
}
echo "</select>";
</code>

[PEAR:QuickForm] Dynamically Change A Dropdown Menu According To Another Menu?
I've been using QuickForm for a few months now and I am now given a
new challenge:

I've got a search form with a dozen of dropdown menus, the first
dropdown menu being "Brand". If you select either Brand A, B, C, D...
Z, the second dropdown menu "Model" must be dynamically changed to
model AA, AB, AC, AD..., according to the models manufactured by the
brand selected in the first box.

I've seen that done on quite a few sites, but never found if QuickForm
had a quick & clean way of doing that.

List Contents Of A Folder, Make List Of Links
Does anyone know how I can write a script that:

- reads in all the files in a particular directory
- displays the file names in a html list and makes a link of them:
<ul>
<li><a href="filelocation1">filename 1</li>
<li><a href="filelocation2">filename 1</li>
<li><a href="filelocation3">filename 1</li>
</ul>

etc.?

So basically it creates a list of links with the contents in that directory,
so you can download them from there.

Get List Of Messages From One Table, Message List Indicator From
I have two tables. One has a list of messages left by users using fields named mbxno for the mailbox and msgno for the message number. I have another table that has mailbox settings for each user that contains a field named "messagelist" to indicate if they want to be included on the message list or not.

What I'm trying to create is a list of the most-recent messages with a lookup on the users table to indicate whether a message in the list should be included in the message list based on the user's mailbox settings.

SELECT messages.msgno, messages.mbxno, users.messagelist FROM messages, users WHERE (users.messagelist = &#391;') ORDER BY msgno DESC LIMIT 100

What I'm getting, though is a list that looks like this:

mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 1114 msgno: 0412141623 msglist: 1

I think what's happening is that I'm using the wrong type of join and more rows are being created than necessary.

If I add "DISTINCT" to the query, I get a list of the most-recent messages as I expect, but the "messsagelist" value is sometimes wrong (again, probably because the data is getting jumbled). For example, the messagelist value for the second row (2214) should be 0, not 1.

mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 2214 msgno: 0412141622 msglist: 1
mbxno: 2189 msgno: 0412141408 msglist: 1
mbxno: 0000 msgno: 0412141213 msglist: 1
mbxno: 0003 msgno: 0412141213 msglist: 1
mbxno: 2265 msgno: 0412132029 msglist: 1
mbxno: 0000 msgno: 0412131950 msglist: 1

How should I be doing this? If nothing else, what kind of join will work with a long list compared to a value from a short list?

Populating A List Box Or A Dropdown List Using Php And Odbc
I need to populate a list box and/or a dropdown list on a form. I have all
the bits and pieces together, all bar the code which takes the result of a
query and creates a list box.

Mailing List Manager, Send To List
I'm looking for a mailing list script (php) that has a function to let
users to reach out to all recipient on the list by simple send the
email to a specific maillist- address.

Mailman has this functionn but as a just got a webserver account I
can't use mailman nor install it.

Getting Another Menu
how can I do to create another menu with the results from the options they choose?
For example, they are looking for their grades so they choose in a first menu the carreer, in other menu the grade, and then when they finish choosing the grade, It appear automaticaly in other menu all the names of the subjects concerned to te carreer and grade given.

Php Menu
How do I have The menu and the context information display at the same time? Code:

Populate One Menu From Another
I thought this would be simple and there would be advice / tutorials
everywhere for this, but now that I'm working on it, I can't find any
reference except for ASP or Javascript code. PHP/MySQL - 3 form select
menus: Project, Categories, Subcategories. When a Project is selected, the
Categories list is populated based on Project selected, then Subcategories
list is populated based on Category selected. I see this all over the Net,
but through 10 books, there isn't anything specific. I think I get lost
with some of PHP structure since I've been using DW - I end up editing most
of it in order to follow it, but DW works pretty good for getting initial
testing done. I just can't seem to find further guidance on this. So far I
have:

Drop Down Menu(add Cat)
I have DB to add category and forum to edit the terms that in the cat so I add this code in the edit forum to change the cat of the term by choose the cat from drop down menu
PHP Code:

Collapsing Menu
I have written the code to do this however I am completely at a loss to do one particular thing. To best explain what the problem is I will give you an overview of how the menu hangs together.

The menu looks like this:

Menu-submenu
I've to create a simple site with menu-submenu.

The submenu are shown in a "dropdown" object that use "<ul><li>"....

Here is the structure:

group1
menu1
menu2
group2
menu1
menu2
menu3
.....

by selecting the link group1, group1->menu1, group1->menu2 I'd like on a
left pane the submenus structure of the group1, but not the substructure of
the menu2 etc.

What's the simple way to create it ? I'd like to modify only once and have
this working on all my site (I use a simple template using a table).

Dropdown Menu
I want to upload a feild values into a dropdownmenu. can anyone help me how to write in php code.

Drop Down Menu
I have a page that uses php to look up specific fields in a specific table of a specific database based on the username. Using this, it creates a dropdown list of information belonging to that user. The fields in question each have 13 pieces of data. Based on what they click in the dropdown box, I need that specific data to pass onto hidden fields on the page. Code:

Drop Down Menu
I'm struggling to get this to work. It is suppose to show only $name and not $name and $email PHP Code:

Drop Down Menu
I am implementing a website with dreamweaver. I dont know much about
programming but I can handle scripts and manupilate.

does anyone know a website that i can get a free drop down menu script
to use on the website's navigation?

Template Menu
I'm trying to decide witch way to do my menu for my program.... see some menu will be accessed by certain users with certain power... but i cant seem to decide with way to do it because... the menu is also template based ( $template = new template( menu.shtml )) anyone has done this in a way to keep the template system integrated and only show certain menus according to there users prv?

Dynamic Menu CSS
I am trying for a long time now, to find a way of creating a dynamic drop
down menu. I have the CSS part ready and working and also I have the first
level of the menu working.
the problem I have is how can I submit the id from the first level menu in
order to make the query and create the second level and so on menu.

I am trying to avoid Javascript but I can't see another way at the moment...
What I want to achieve is to produce the menu on HOVER if that is not
possible on click will be ok as well.
Do any of you have an idea ?

This is the code I have :
**********************************************
<div id="menu">
<ul>
<li><h2>Products</h2>
<ul>
<?php do { ?>
<li><a href="?cat_id=<?php echo
($row_product_categories['prod_category_id']); ?>"title="<?php echo
strtoupper($row_product_categories['prod_category_name']); ?>"><?php echo
ucfirst($row_product_categories['prod_category_name']); ?></a></li>
<?php }
while ($row_product_categories =
mysql_fetch_assoc($rs_product_categories)); ?>
<ul>

<?php do { ?>
<li><a href="index.php?id=<?php echo ($row_products['prod_id']);
?>"title="<?php echo strtoupper($row_products['prod_name']); ?>"><?php echo
ucfirst($row_products['prod_name']); ?></a></li>
<?php }
while ($row_products = mysql_fetch_assoc($rs_products)); ?>

</ul>
</li>
</ul>
</li>
</ul>
</div>
**************************************************

Drop Down Menu
I have 2 drop down boxes on my site. I want the selection of the
first one to populate the second box.

Drop Down Menu
What i would like to do is look in a file and see what the name's of the files are in there and have them put in to a drop down menu. Dose some one know of a tutorial on this or how to do it?

Drop Down Menu
I have a problem with a drop down menu, I have 2 drop down menu's if 1 select in dropdown menu 1 a catagorie then I must give this to menu 2 and then there must be things in menu to with catagorie from menu 1 I just want when I clicked menu 1 the php file refreshed en gives the catagorie with the refreshed file but HOW?

Menu/submenu
I wish to make a menu (in php), and every time a menu-item is selected, a
sub-menu will be visible.

Triple Menu
I'm going to have a website that will have a very dynamic menu structure (one that could change every few minutes) and it is essential that everytime the menu is built, the updated database entries are included.

Background:  The site is a homework study site that gives study tools, etc.  So lets say that i want to look up the Math (subject or "class"), Pre-Algebra ("course"), CPM ("curriculum"), i would first select Math in the first drop down menu, then Pre-Algebra in the second, and then CPM in the third.  In the second and Third boxes however, there will be other courses and curriculums to choose from.  Those will be updated very regularly and i do not want to do this manually. Code:

Drop Down Menu?
Im looking for a script for a site im making that will make a drop down menu which I can customise the color of. Simple, like a border and background color, but is friendly with all types of IE explorer.

Drop Down Menu
I am using the following code to loop 12 months backwards from the current month in a drop down list - using the get method.

I'm having difficulties trying to get the option selected once I have submitted the form.  For example, I am using this to filter months, so once a month has been selected and submitted, the first option in my drop down list is displayed and not the one that was selected and submitted. So basically, I need to be able to select a month > hit submit and when the form returns, have the drop down list show me the selected item. Code:

Using Jump Menu
I am using a jump menu to select multiple drop down boxes in a form which are related to the choice you make in the first drop down box.  The problem is that the page reloads and everything before this tag is cleared.  I want to be able to repost the data.  I know that I need to use sessions in my code but I dont know exactly how to use them for this case. Code:

Drop Down Menu
i want a drop down menu that will select which database is needed for that page..

see i have a site im making for a clan that plays like 10 different games and i wanna have 1 index but the dropdown menu will be at the beginning and when a player goes to the site they can choose which game they play so they can check the news and stuff.. the drop down menu should choose which database is needed? can this be done or will i have to make 10 different index.php pages?

Drop Down Menu
does anyone have the code to have drop down navigation on a website?

Vertical Menu
anyone here has done a vertical menu using php with mysql database? something like this:

menu1
  > submenu1
  > submenu2
  > submenu3
menu2
  >submenu4
  >submen5

then when you click the menu it shows/ hide the submenu.

Array For Menu - Need Number Of Row.
I'm building a template class for a new website. For it to be a proper template I need the menu to be changeabel as well. So I tried adding to the menu array so I created a multi array, but then I couldn't get the name or the url out of it. Maybe I shouldn't use multiple arrays or maybe I should construct them differently, I just don't know. I need the line number for a javascript popup submenu.

Mysql Php Dynamic Menu
I am trying to write a script that will create dynamically a menu from MySQL
database. The database table is a product categories table and it has the folowing filed:

category_id, parent_category_id, category_name (some other fileds are there
as well but these are enough to figure out the logic)

I know that I have to store all the product_categories records in a temp
array and then some how go through them and store the level of each record
in the menu....

If you have done something like that I suppose you know what I mean and I
would much appreciate to give me a hint here ...
I had a look in the phpLayersMenu from sourceforge but it is really advanced
OO code and I cannot understand the logic....

My target is to create a Tree menu with no pre - defined number of
records...

Dynamic Navigation Menu
I need to build a dynamic menu that will include certain links depending on what variables are in the URL. This is doable - right?

For example: catalog.php?product=widget&color=green

Menu would look like:

Green Widgets
Brand 1 Green Widget
Brand 2 Green Widget
Brand 3 Green Widget
etc.

Any help would be greatly appreciated!

Php Drop Down Menu Variable
I have been playing with one script for more than two weeks. It is a simple poll script.
Once the user has selected from a drop down menu...it is mailed to me. The problem is that I only get the first word of their choice! That defeats the purpose of having the poll!

Echo Drop Down Menu
What I do is when the form is posted (php_self) it does its check and if there are errors, ie. user has not filled in required data, it takes them back to the form but the text fields are already filled in with what they have already typed.

But the drop down menus default back to the PLEASE CHOOSE option, how can I get my drop down menu to be what they have just selected. The reason I need this is there are 6 drop down menus for different things on the page and a user would get fed up having to reselect each one when they have not filled in a field. Code:

Dynamic Select Menu
I am trying to populate a select menu with data from a mysql db. I get the select menu, but no content or errors. The two fields are id and websites. Here is the code:


Copyright © 2005-08 www.BigResource.com, All rights reserved