Self Populating Drop Down Menus
i am trying to do is the following: I have a MySQL database that (very simplified) has a schema like this 'Students(Name, id, Course)' I would like to have a form on a web site that has 2 linked drop down menus, one 'Please select id' and one 'Please select course'. When a user of the site selects there Id from the first drop down menu, i want the second drop down menu to populate itself with the courses held in the database for the given users Id. I would like the first drop down menu to be populated from the database with a query similar to 'SELECT id FROM students'.
View Complete Forum Thread with Replies
Related Forum Messages:
Conditionally Populating Form Menus
I wondered if I could ask another question: I have a form which will allow me to populate a garments table within my database. Among the elements in the form, there is a suppliers drop down menu and a categories multiple select menu. I used the following code to populate these menus. Code:
View Replies !
PHP And Drop Down Menus
I've looked through the forum rather extensively and my qestion is similiar to the question by Brian_F and answer by "saintaw" a couple of days ago in this forum. I already have a functional page that has several dynamic drop-down menus from which the user selects a topic of interest. My question is how to reference their choice from the drop down menus in order to display the results of their choice. I would like the user to be able to choose a subcategory with one of the drop down menus and then be able to view the questions related to that subcategory. I currently have a nested for loop which displays the categories and subsequent drop-down menus for each category, and I'm using PHP and MySQL to do the dirty work. code:
View Replies !
Drop Down Menus
I am trying to build a database system to keep track of busdrivers and how much this company owes them. So what I have done is I have made 3 tables. One for the driver and info like name, address, city etc. number 2 table with sales info etc. and the third = more slaes info. So what I am trying to figure out is how on lets say forms to be able to choose the driver and add sales info to it? So here are my tables: Code:
View Replies !
Drop Down Menus And PHP
I am making a simple email application in PHP, I am wanting it to have a drop down menu for the importance of the email. I have looked around on google and I do not seem to find anything.
View Replies !
Dynamic Drop-down Menus
I am developing an on-line booking system, and am designing a script which creates a booking "area". An area has the following fields: Area Name Day start time (the time of day bookings can begin e.g 9 AM) Booking Time Slot (the length of time for each time slot e.g 30 mins) Day Finish Time (the time of day bookings must finish e.g 6 PM) What i require is a method for locking down the users input so that the finish time is a list that is created that is divisable by the number of minutes used for a booking time slot . e.g. if the start time is 9 am and each booking time slot is 30 minutes, then the user must select a finish time which is divisable by 30 i.e. either on the hour or half past. I have looked at several methods for doing this but cannot decide what would be suitable. Ideally I want the user to be able to select the start time from a dropdown (static html would do) the select a booking time slot (again a static html dropdown would surfice) and then a dynamic dropdown be created with a list of Day Finish Times. My questions are these: Is this the right way to go about doing this - are drop downs my best option? If so, is calculating the day end time list the best way to go? Would javascript be more suitable, rather than a php form?
View Replies !
Getting Data From Drop Down Menus
I have a drop down menu and I'm trying to find out which option they have pressed. I need to use the $_POST method to do this. Below is what i've written so far, but it's showing every time the messages: "You don't have enough points" AND "you gained blah blah exp" I've blocked out some of the stuff that calls up files and stuff, just for security reasons Code:
View Replies !
Concatenate Drop Down Menus
We would lke to have two drop down boxes on a search page. for example one drop down will contain light bulb wattages( ie 40, 50, 60) and the other drop down will contain type of bulb ( round, oval, twisty etc.). These drop down boxes would be hard coded. no need to change them. how would we concantenate the two drop down boxes. ie. if someone chooses "50" and "twisty" the result would be one field that would contain "50 twisty". how do we do this. Then we need to use this new field to search the database and extract all the prodcuts that meet the criteria.
View Replies !
Linking Drop Down Menus
I'm very new to the PHP world and I'm trying to create two Drop Down Menus that are linked. For example if the first drop down menu had all the States listed and the other drop down would show all the cities to choose from once a State was selected in first menu narrowing the list. Hope this makes sense and I hope the solution is simple at this point of my education level.
View Replies !
Connectin Two Drop Down Menus
I want to create to drop down menus where the second one will display options according to the option selected in the first one.For example: 1st Drop down menu contains: - Premiership - Campionato - Bundesliga - La Liga 2nd Drop down menu should contain the teams of the championship selected fron the first drop down menu. Any ideas?
View Replies !
Drop Down Menus And Form Processing
I select a client from the first drop down menu, then a list of events for that client is shown in the second drop down menu. I then want to select the event from the second drop down and automatically go to a form I built "editevent.php3" showing information echoed from mySQL for that event. I have started the code, but know it is not complete. Code:
View Replies !
Php And Drop Down Menus Or Using Java Script?
I have a question about PHP and drop down menus. Should I be using PHP for my drop down menus or should I be using java script? I have a whole contact form that is programmed in PHP, but I have never done a drop down menu with PHP, is this possible? If anyone knows of any great drop down menu tutorials in PHP.
View Replies !
Insert Date Using Drop Down Menus
I know how to insert a date by filling in a field but I don't know how to do it using a drop down menu. One menu being month, another the day and the last the year. Any code snipplets I can disect and play with or tutorials on this?
View Replies !
Drop Down Menus And Mysql Insertion
I'm looking to create drop down boxes for a user to select the date and then have it insert what they select for month, day, year, hour, minutes and insert it into mysql. It needs to be organized in a timestamp like so: 2007-02-28 21:06:40 I've created the drop down boxes and it works pretty well: Code:
View Replies !
Add Some Data From Drop Down Menus Into A Database.
I need to add some data from drop down menus into a database. The form loops on itself to add the data. I'm not sure which part I need to add the dollar too, i.e. the select name or the values in the list, in order to make it work. I've included part of the code below: PHP Code: $form.="Cateory 1*: <select name="cat"> "; Â Â Â Â $form.="<option value="Action">Action</option> <option value="Comedy">Comedy</option>"; Â Â Â Â $form.="<option value="Drama">Drama</option> <option value="Family">Family</option>"; Â Â Â Â $form.="<option value="Horror">Horror</option> <option value="Misc">Misc</option>"; Â Â Â Â $form.="</select>
View Replies !
Multi-level Drop Down Menus
I am building a search page. There are 5 drop downs from which the user can select search filters. However, some of the drop down list selections will invoke a sub-list. I was hoping to use javascript only to invoke a refresh when the menu item was selected from the drop down, and then use php to re-build the form plus the sub-list drop down menu. I can get javascript to refresh the page, but all other form fields are lost. I don't want the user to press "submit" to invoke a sub-list because a "submit" button implies that the search will begin, not that there will be more items to select.
View Replies !
Creating Infinte Drop Down Menus
I have categories which contain sub categories which contain other sub categories etc etc.... Ive got a drop down which shows the first lot of categories, then another drop down displaying the sub categories depending on what the user clicked in the first place. Then another displaying the next set of sub categories depending on what they chose in the second drop down etc. Code:
View Replies !
Values Into Radio/check And Drop Down Menus
I am attempting to create an update form where the current fields in the table are populated into input boxes and then can be altered where necessary. I was wondering if it is possible to pre check radio buttons, check boxes and pre populate drop down menus based on the results currently in the table. eg. if the gender of a person is male then the radio button will be pre checked as male. How would this be done.?
View Replies !
Populating Drop Down
How do I do this drop down box ? Making an edit page. I have 2 tables groups id || categoryname program id || cateogry_id I need to populate the groups in it at same time show the selected choice from program. Not showing id but needs to show categoryname with of course the values being the id of groups.
View Replies !
Show Selected Value For Drop-downs In Dynamic Menus
I frequently work with forms where menus are pulled from a database. When a user enters data in the form and then saves it, if it is retrieved later, the form shows the saved data, including the drop-down menus. The way I normally do this in php is to first retrieve the data for the saved from. Then I create the menus and within the loop of creating the menus I simply add the word "selected" into the results row which equals the saved option on the form. Code:
View Replies !
Populating A Drop Down Menu
How would I go about populating a Drop Down menu from data in MySQL? If you can show me wither a URL to learn this, or if you feel like telling me here, that would be great.
View Replies !
Populating Drop Down And Table
I have a database with the following fields. Name | Company | Date values in each column could be repeated, or not. as in there could be several same names with the same company with different dates, or different names with same company. How do I populate a table with this info and have drop down boxes, so that I can narrow down the search? For example: Name | Company | Date 12 | 1 | 1929 13 | 1 | 1929 14 | 1 | 1929 12 | 2 | 1929 12 | 4 | 1929 13 | 1 | 1941 12 | 6 | 1929 So if in the drop down I select '12' under name, only those entries with 12 are shown, and then I can further sort it by selecting only '1' under Company. Hope I'm clear, I manage to complicate things when I post them.
View Replies !
Auto Populating A Drop Down Box
Basically I'm setting up a website which needs an populated drop down box made up from all fields in a specific column of a table in a mysql db.... Here's the code I've made up using various tutorials.... <?php $user = ""; $host = "" $password = "" $dbName = "" /* make connection to database */ mysql_connect($host, $user, $password) OR DIE( "Unable to connect to database"); mysql_select_db($dbName); //did you forget this line? $sql = "SELECT model FROM usedVehicles"; $query = mysql_query($sql) or die(mysql_error() . "<br>$sql"); //use the or die(...) part ONLY IN DEVELOPMENT ?> <form action="action" method="post"> <select name="option"> <?php while ($row = mysql_fetch_array($result)) { echo "<option value="" . $row['model'] . "">" . $row['model'] . "</option> "; } ?> </select> <input type="submit"> </form> I've left out the connection details for obvious reasons... When I upload and try to test this, jus a blank drop down appears... there are definately fields in the column as I have tried the query on phpMyAdmin.
View Replies !
Populating A Drop Down List With Php
I am trying to get a drop down list to populate vbia php. What I have a is a script that allows a airline/user to enter airfare and price for tickets. It dumps them into a database and then allows the user to view/delete/add. I want the user to be able to edit the airfare. I have a drop down list that is set as a variable $ticket_from, $ticket_to. The list contains around 400 cities. When the user clicks 'edit' I have the price population but no the drop down list. How do you go about something like that? I have this right now: Code:
View Replies !
Populating Drop Down Lists
Could anyone help me on populating database driven drop down menus. I am trying to populate a second drop down list based on the selection of the first drop down list. I have the first drop down list running. Not sure about getting the second now.
View Replies !
Populating Drop Down From A Query
I'm trying to populate a drop-down box from the results of a query. I end up with the first option coming through and then blanks in the rest. Something like this... <option value=Acevedo>Acevedo</option> <option value=></option> <option value=></option> <option value=></option> <option value=></option> .......
View Replies !
Populating Drop Down From MySQL
I am trying to populate a drop down menu of MySQL data using PHP and I have hit a snag. I think its probably something simple that a freah pair of eyes could pick out right away that I am just not seeing... For some reason only the "firstname" part of the data is populating in the drop down and I can't figure out why. When I try to make changes to the echo lines to correct this, nothing shows up including the "firstname" data. Code:
View Replies !
Populating Drop Down Menu
I use the following code snippet to build a drop down menu with the results of a query. How can I set the initial value of this input based on the result of another query? What I am trying to do is update records in the data base. The field WkEndDate is pulled along with the rest of the record and the drop down menu is built from a table of valid WkEndDate values. Code:
View Replies !
Populating Drop Down Fields
I am trying to populate a drop down menu with a mysql database. I was hoping to have a selection of months in the dropdown menu, based on date fields in my database when a user then selects a month, they will be brought to a new page that will have only the records created in that month. But in my database, the date is stored in this format: 2006-05-12 00:00:00 if you need to see my code, here it is: <? //database connection $query = mysql_query("SELECT * FROM casinocredit"); // start to print out the form echo "<form action="cats.php" method="POST"><select name="clients"><option value="" "selected">Select A Client</option>"; // loop through the records while ($row = mysql_fetch_array($query)) { echo "<option value="{$row['ID']}">{$row['ddate']}</option>"; }.........
View Replies !
Populating A Drop Box With Results From Database
I have a MySQL database with a table (category) with two fields, catId (int) and category (char(50)). What I want to do is to get all category names in this database and place all of them into a dropdown box on a web page so that the user can choose from the list of available categories.
View Replies !
Populating A Drop Down Via A File Directory?
I just wrote this code: $dir = "/images/news"; print "<select name='file'>"; $dir = opendir($dir); while (false !== ($file = readdir($dir))){ if (in_array($file, array(".", ".."))) continue; print "<option value='$file'>$file</option>"; } print "</select>"; But for some reason it is not populating. It instead echoes an empty drop down menu. Can anyone suggest anything?
View Replies !
Populating A Drop Down From A MySQL Table
When they click submit, I want the name dropped from "invite" and added to a table "guests" with their answer if they are coming and how many. I know the SQL to make it happen, but I am pretty sketchy about the PHP. Code:
View Replies !
Auto Populating Multiple Drop Downs.
im trying to create two dropdowns, i need the first one to be the category and the second one to be the subcategory. The category drop down autopopulates with the correct info from the database. and uses the table "category", the value of each drop down is represented by the "cat" field in the table (cat is basically and integer id number) and "Category" is used as what the user actually sees in the drop down (category is the actual word of the category). Once the category is selected i would like to have the sub category auto populate with everything that has the same values as the selected category (cat) Here is a break down of how the tables work. Table 1 Name: "category" Fields for Table 1: "cat" (the id number), "category" ( the actual name of the category) Table 2 Name: "subcategory" Fields for Table 2: "cat" (corresponds with the cat id from table 1 to pull the correct data), "subc" (the basic id of the subcategory), "subcat" the actual name of the subcategory. so the way i see it, have a normal drop down populated by a php query. then on change, populate subcategory drop down where cat = cat and display sub category.
View Replies !
Populating The Drop Down And Pressing The Submit Button
1. The first is I have two drop down menus. The first is "year" and the second is "mfr". When a user selects a year from the drop down it then populates the second drop down, mfr, from the MySQL database. Theat is working fine. But the problem I am having is the "submit" button (which I have labeled as "browse"). When I click it. Nothing happens, no action tacks place. I have looked over the code and I can't figure it out. (See Code Box 1 Below). 2. Right now the "mfr" drop down is populated by the MySQL database and reads with a list like "Acr", "Alp", etc. These are abreviations. I need to set up an array to have them instead read the entire mfr name. Example: Instead of "Acr" it needs to be "Acura". Instead of "Alp" it needs to be "Alpine". I need these full names to appear in the drop down. I know I need to do something like this (See Code Box 2 Below) but I can't get my finger on it. Code:
View Replies !
Populating Drop Down List With Selected Vaue
I have a drop down box and the "selected" value needs to be selected by a dynamic value that gets entered into the database, this is currently how im doing it: PHP Code: <?php                 if($modify_row[21] == "0") {                   print "<option value=" "></option>";                   print "<option value="1">Active</option>";                   print "<option value="0" selected>In-Active</option>";                 } elseif ($modify_row[21] == "1") {                   print "<option value=" "></option>";                   print "<option value="1" selected>Active</option>"; Its fairly straight forward, basically the option that is automatically selected needs to be the one coming from the database $modify_row[21].
View Replies !
Populating City,state,country Drop Down Menu
In the registration form I have city, state, country fields. I was wondering if there was a database available on the net which has the list of states in each of the countries. That way when a user selects a country I could automatically populate the state drop down menu ...
View Replies !
Drop Down Menu Select And Populating Data Fields
I have a PHP/MySQL Content Management System set up for the job I work at. It's basically a shift program that lets users pick up shifts, post shifts, etc. The data fields are tied to the shift ID which is selected from a dynamically populated drop down box. However, I cannot get the data fields to be updated when I select a new value and I cannot get the form to accept the new selected Shift ID. I have tried using JavaScript but cannot quite get it to work. Code:
View Replies !
Populating Multiple Drop Down Boxes From Mysql Table
Am having a problem with a dynamic, multiple drop down box query. If I run the code with only one select, it populates fine. If I run it with 2 selects then only the first drop down box populates - the second drop down box is empty. Am wondering if I need to put the query into an array and populate the boxes from there. Code:
View Replies !
Menus In Php
currently i have web application in php which has its menus created in javascript. if we do view source on the page, it displays all the javascript which is obvious n natural. but it displays all the file names of php too which are related with those specific menus. dont we have any way by which we can prevent it. as an alternate i m thinking of creating the menus also in php so that the names of my files dont get visible to the user from the security point of view. is it sensible to do so because it will be an extra overhead to the system for creating the manus everytime.
View Replies !
Menus
I'm looking for a way to build a dynamic menu systems. I have a project that I have under way that will help you spec a computer system. I will be using drop down (select) menus, and I wanted to know if its possible that if you select one option that it would remove certain options from the next menu as they would be incompatable with what was selected above.
View Replies !
& Menus
Firstly I am a fairly recent newbie to PHP & MYSQL but I am catching on pretty well. I would like to use them to build a dynamic menu system for a catalog type website. I have several 'category' names that can change. I would like to recall the category names from the database and use them to build a set of menu 'buttons'. When a button is pressed, I would like to assign & pass a variable (the category actually) back to another php script that searches the database for all items in that category and builds a display page. I have most of it figured out except the part about how I can construct the menu so I assign & pass a different variable out of the menu when each button is pressed.
View Replies !
Sticky Menus
It's common courtesy to ensure that a form with validation problems reposts with the fields still filled in, so the user doesn't have to start over, by echoing the variables in the Value attribute of the text fields, but I also want to have a drop-down menu to be sticky and retain its selected state when the page reposts.
View Replies !
Dynamic Menus
<?php include('./common_db.inc'); $link_id = db_connect(); mysql_select_db("test_db"); ?> <form name=carform action= <?php echo $_SERVER['PHP_SELF']; ?> method=post> <?php $query =mysql_query("select DISTINCT CQ_PROD_PLATFORM AS make_id from CQ_data ORDER BY make_id"); echo '<select name=make onchange="document.carform.submit()"'.">"." "; if (!isset($make)) { echo '<option value=null selected>Choose a Make</option>'." "; } while(list($make_id) = mysql_fetch_row($query)) { echo '<option value='.$make_id; if (isset($make)&& $make_id == $make) { echo " selected"; } echo '>'."$make_id".'</option>'." "; } echo '</select>'." "; echo '<select name=model onchange="document.carform.submit()"'.">"." "; if (!isset($make)) { echo '<option value=null selected>Choose a Make First</option>'." "; } else { $result = mysql_query("select DISTINCT CQ_SUBSYSTEM AS name from CQ_data where make_id='$make' ORDER BY NAME"); echo '<option value=null selected>Choose a Model</option>'." "; while(list($model_id) = mysql_fetch_row($result)) { echo '<option value=' . $model_id; if ($model_id == $model) { echo " selected"; } echo '>$model_id</option>'." "; } } echo '</select>'." "; ?>
View Replies !
Dropdown Menus
i would like a Dropdown menu ordered by the parent cat and then showing its sub cats like below: <SELECT> <option value=0>Cat Name</option> <option value=?>-Sub Cat</option> <option value=?>-Sub Cat</option> <option value=?>-Sub Cat</option> <option value=0>Cat Name</option> <option value=?>-Sub Cat</option> <option value=?>-Sub Cat</option> <option value=?>-Sub Cat</option> </SELECT>
View Replies !
Dymanic Menus
I have products stored in a MySQL database with each product belonging to a category. That category may sit under one or more other categories. What I need to be able to do it produce the site navigation based on the different categories and their parent categories. So basically I need to be able to produce the following HTML dynamically based on the categories store in the database. <ul> <li>Category 1</li> <li>Category 2</li> <li>Sub Category 1</li> <li>Sub Category 2</li> <li>Sub Sub Category 1 <li>Category 3</li> </ul> How would you store the category information in the database and what would the PHP script look like to produce the navigation?
View Replies !
|