473,385 Members | 1,673 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,385 software developers and data experts.

dropdown list populated from stores table in database

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.....everybody is always very helpful
Mar 25 '07 #1
6 5513
ronverdonk
4,258 Expert 4TB
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
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 Expert 1GB
It sounds like php cookies may be the answer to this problem
Mar 27 '07 #4
It sounds like php cookies may be the answer to this problem
php cookies?
Apr 2 '07 #5
code green
1,726 Expert 1GB
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
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?$userselection1=$select1a" 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=\"$userselection1\" selected>$userselection1</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?userselection1=$select1a. 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=\"$userselection1\" selected>$userselection1</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
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...
0
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...
5
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...
11
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...
5
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...
1
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
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"))<>""...
2
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...
3
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...
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...
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.