473,903 Members | 5,218 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

dropdown list populated from stores table in database

56 New Member
Hey everybody

im creating a report for regional managers, i have created a table called STORES, what i want to be able to do is that when the page loads,

it currents has the users name n id, but in the days columns mon-sat its empty, and i would like to hace those colums contain drop down lists of the stores from the stores table and save by default when the page next loads, so they dont have to keep going through the dropdown lists.

iv beden rackin my brain, even just manually filled dropdown lists,but thought if could get it from database it would be better.

thanks guys.....everyb ody is always very helpful
Mar 25 '07 #1
6 5548
ronverdonk
4,258 Recognized Expert Specialist
Do you mean you want to load the drop downs from the db, have the user select an entry/entries, submit the form and then save that dropdown value or values for the next page?

If not, explain and show some of the code you have made, maybe it gets more clear.

And do not forget to enclose that shown code within php or code tags! Otherwise it will be unreadable for us.

Ronald :cool:
Mar 25 '07 #2
DavidOwens
56 New Member
Do you mean you want to load the drop downs from the db, have the user select an entry/entries, submit the form and then save that dropdown value or values for the next page?

If not, explain and show some of the code you have made, maybe it gets more clear.

And do not forget to enclose that shown code within php or code tags! Otherwise it will be unreadable for us.

Ronald :cool:
they have a main screen, click the region so say region1, they then put in password, this then redirects them to a table containg user information for that area.

mon-sat users will be in locations, which i would like to be displayed as a drop down,but they are automaticaly generated from the database, they then check the checkbox to save as default, so they page is displayed with the locations stored when viewed again.
Mar 25 '07 #3
code green
1,726 Recognized Expert Top Contributor
It sounds like php cookies may be the answer to this problem
Mar 27 '07 #4
DavidOwens
56 New Member
It sounds like php cookies may be the answer to this problem
php cookies?
Apr 2 '07 #5
code green
1,726 Recognized Expert Top Contributor
OK maybe not!
Why not save the users selection into a seperate field?
Then when the same user logs on, check if he has anything in that field.
Apr 3 '07 #6
xerc
14 New Member
Maybe I don't understand your need, but is all you want is a drop down menu dynamically created from a PHP query to a database? And then the user selection of the drop down menu carried to the next page?

If so, you would do something like this. The value of pull down menu #1 on the first page might be referenced as 'select1a'. This gets passed in a URL post to the next page through the typical form submit. So something like "page2.php?$use rselection1=$se lect1a" would be the URL in your form post value. Page two then uses the exact same dynamic method to create the pull down menu, but now you insert the $userselection1 value (which was the menu name/value of $select1a from page1.php) passed in the URL as a 'selected' option in the menu before looping to populate the list. For instance <option value=\"$userse lection1\" selected>$users election1</option. If $userselection1 is a value but not the lable you want displayed in the drop down menu, you'd have to do a separate database query to retrieve the associated name value on page 2. In quasi script, it would be like.

----------------------------------------------
PAGE1.php
----------------------------------------------

SELECT * FROM youtable ORDER BY whatever

print "<select name=\"select1a \">";

for ($x=0; $x <= mysql_num_rows; $x++){

print "<option value=\"$row[value]"\>$row[name]</a>";

}

print "</select>";

-----------------------------------------------
***Now post the value from the menu option to page2.php in the URL through a form submit, such that page2.php URL is, page2.php?users election1=$sele ct1a. Obviously you could use sessions or more advanced methods to pass the values, but this is the cheap and dirty.***
----------------------------------------------

----------------------------------------------
page2.php
----------------------------------------------

SELECT * FROM youtable ORDER BY whatever

print "<select name=\"select1a \">";

print "<option value=\"$userse lection1\" selected>$users election1</option>"

for ($x=0; $x <= mysql_num_rows; $x++){

print "<option value=\"$row[value]"\>$row[name]</a>";

}

print "</select>";
Apr 3 '07 #7

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

Similar topics

3
7098
by: Charles | last post by:
I am trying to add the ability for a user to change the order in which the elements are listed in a dropdown list box. Before I added the ListID field the dropdown list box order was controlled using the MotorhomeID. The problem I am having is that I don't know the best method for allowing people to make the ListID changes easily. Database: MS Access 2000 Table: Default-Motorhome Fields:
0
1303
by: E . | last post by:
I seem to be getting nowhere with this problem here is the situation. I have a webform with a data grid populated with the results of a table that has only 3 fields. Then below that are 1 dropdown list, a text field, and another dropdown list and a button that represents and add routine to put data into the table. The dropdownlists are populated on the onload event of the controls, they are working fine. Also adding records is...
5
11908
by: jung_h_park | last post by:
From: jung_h_park@yahoo.com Newsgroups: microsoft.public.dotnet.framework.aspnet Subject: Dropdown List not retaining its SelectedValue Date: Mon, 26 Jun 2006 21:02:57 -0700 Hello, My dropdown list control does not retain its SelectedValue. Unless I read the SelectedValue right after the control has been loaded, populated, and assigned with its original value (and of course that is
11
7413
by: eureka | last post by:
Hi All, I'm training in Servlets, JSP and JavaScript, I have a web page in which there's a "StudentName" textbox and below it is a "Names" Dropdown list. Initially the Textbox is empty and the Dropdown doesnt have any items.. The requirement is that as soon as one goes on typing the letters in the StudentName-textbox the corresponding matching names have to appear
5
3459
Tann3r
by: Tann3r | last post by:
Apache.v2.2.4, MySQL.v5.0.27, PHP5.2.1 I have a table of projects which has been dynamically created from an SQL query. I have several dropdown boxes which have been populated from other tables within the database and i would like to filter the information shown in the main table dependant upon the items selected in the dropdown list(s). I assume that this needs to be done using java to enable the list to be refreshed as soon as a dropdown...
1
3330
by: chaos | last post by:
HI all, Anyone know what is the php code to get a value from drop down list and connect to database to search for that value???
1
1876
by: fran7 | last post by:
Hi, Anyone know how to populate a dropdown list with data from database. I have an interface that generates the following code for names in my database. ..asp <%If Trim(rsCard("Author"))<>"" Then%> <%=rsCard("Author")%><%End If%> .. How does one populate a dropdown list??
2
1448
by: JJ297 | last post by:
I have a dropdown list populated via a database. I edited the dropdown list to have "select a topic" to always appear when the drop down loads. Now if a user selects a dropdown item it goes into the datagrid fine, but if a user selects "select a topic" I get an error message... Error converting nvarchar to int on adapter.Fill(ds) Here's the code behind can someone please assist? Thanks! Protected Sub...
3
2242
by: Dick Benton | last post by:
I would like to be able to select a field entry in Table A from a pull down list populated from Table B which is linked to Table A by that field. ie Table B contains the Server ID as key plus descriptive attributes. I also have an Applicatio9n Table and when entering data into the Application Table I wantto be able to enter the Server ID for that application and get it from a pull down list created from all the Server ID entries in the Server...
0
9999
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9847
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10501
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9685
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8049
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7206
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6093
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4727
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3324
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.