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=Ɔ'>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>
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:
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>
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.
A Dynamic Drop Down List
I need to create a dynamic drop down list. By this i mean that the webpage html form = select style will recieve all the values as based on a query to a mysql database. I have no problems quering the data base with PHP, But i need to make some kind of for loop that will add a new value to the selct form for each result from the database. my thought process go like this. 1. call data base to guery. (no problem) 2. make variable variables that will be created according to the number of results (these variables must be created according to results of query, not a problem i think) 3. make a form like this <form action = ***** method = post> <select name = ******> <option value = "This is a query result"> This is a query result> //This is the part i need to using a for loop and variable variables </select></form> so my problem is part 3, cause is this all done in PHP, or if i had all these variables, can i do this in HTML? Can i make a for loop in PHP that would break into HTML during these parts?
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?
Dynamic Drop Down Menu
I'm having difficulties displaying the MakeModelID for a row selected from a drop down menu I've populated from a table combining three attributes (Make, Model and Specification - for example Ford Transit LWB 350 HR). What I require is to capture in a variable, such as $MakeModelID, the ID for that record selected. Code:
Dynamic Associated Drop Downs
I wrote a function to pull country values from my MySQL database into my forms country drop down list. This works great. However, I want to also pull region/state data for my form's region drop down list whenever a country is selected/changed in the country form field. I know I can do this with javascript but I want to do it with PHP only. Can I do like a onclick command on the country field and have it resubmit the query that populated the region field? I think this is possibe but not sure how to do it.
Dynamic Dependent Drop Down Boxes
I need to build a dynamic page with 2 drop down boxes on it where the contents of the second drop down box are dependent upon the selection made in the first drop down box (the first box contains districts/regions and the second box contains towns/cities). The customer wants this to happen on a single screen but can this be done with PHP?
Dynamic Drop Down Boxes With Php Query
I need to build a dynamic page with 2 drop down boxes on it where the contents of the second drop down box are dependent upon the selection made in the first drop down box (the first box contains districts/regions and the second box contains towns/cities). The customer wants this to happen on a single screen but can this be done with PHP? The above question is already answered by many people and they want me to use Javascript. My doubt is the second box shoud query the list from a table in mysql using php. How do i do that?
Dynamic Drop-down List In Array
Q. How do I create a dynamically-generated drop-down list for use in an array. I'm using PHP with a MySQL database (through phpMyAdmin) My database table is called com_courses, and I want to pull the distinct 'title' fields and have them appear as a drop down menu for the user to select in a form. Here is my array, with (at the moment) manually-entered 'titles' (which I now need to be dynamically generated from my database field: 'com_courses.title' array ( "coursetitle", "Course Title:", $EXTRA_SELECTLIST, array ("Report Writing", "Recruitment & Selection", "Presentation Skills", "Essential Telephone Skills", "Time Managememt", "Customer Care", "Other"), 0 ), I am not an experienced programmer, but can play around with php to customize programs. I've read up on arrays (I bought a "Programming with PHP and MySQL" book, but it just stops short of this problem). I can't figure this one out.
Creating Dynamic Drop Down Menu
I have a mysql database called Auditions with a table called Sept7. The table has two columns Time and Name. I want to create a dynamic pull down menu and populate it with items pulled from the table based on a query. Code:
Dynamic Drop Downs With Php And Java
I'm working on a project where I need the drop down menus to be dynamic almost identical. I found a java code that looks to do what I want it to do. But, being that I know very little about this, I'm not sure what goes where.
Dynamic Drop Down Boxes With Mysql
I'm working on a database project for a class and am having problems populating select boxes with a field from a mysql table. The first thing that I'm trying to do is pull the field LastName from the table Faculty. Then when the user selects the faculty member in the drop down box, it will then display all of the fields related to that faculty member...first and last name, title, office number etc and allow the user to edit those fields and then resubmit them to the database. However I can't seem to get the drop down box to populate, so if anyone has any suggestions as to how to fix this I would love to hear them. Code:
Dynamic Drop-down List With Array - Question
Can anyone out there give me a pointer regarding creating a dynamically-generated drop-down list connected to an array? And is that question as clear as chocolate spread? Here's what I've got. I'm using PHP and MySQL database. I'm customizing some calendar software, and I want the user to fill in a form by selecting a title from a drop-down list, generated by my MySQL database. However, the program I'm customizing uses arrays, which is where I'm stumped. What do I need to add to this code to make the array of titles(eg "report writing" etc) come from my database, rather than the manually-entered values that you can see here. The field I want to pull from is called com_courses.title array ( "coursetitle", "Course Title:", $EXTRA_SELECTLIST, array ("Report Writing", "Recruitment & Selection", "Presentation Skills", "Essential Telephone Skills", "Time Managememt", "Customer Care", "Other"), 0 ), I hope it's not cheeky to ask this, BTW I bought a book on Programming with PHP and MySQL, but it doesn't answer this question,
Multiple Drop Down Search
i created two dropdown lists. One lists the months. And one lists the years. I want to be able to populate a sql query with the choices the user makes in the dropdown to display the correct choices. PHP Code:
Multiple Drop Down Boxes
I want to create two multiple drop down boxes, the first will display all the company names, once this has been selected all the stock information for that company will appear in the second drop down boxes.
Multiple Selectiosn From Drop Down
I have a drop down box that I want people to be able to choose one or more of the options (multiple selection). How do I make mysql recognise this and add all entries into the table.
Multiple Search With More Than 2 Drop Down Menu
I have problem with multiple search with more than 2 drop down menu. After submit from search.htm, in the results.php page i dont get results or error and i dont know where the problem is. look my code and tell me if you see something or error in sourcecode PHP Code:
Multiple Drop Down's For Search
I am looking at adding a search section to my site whereby visitors select from two drop down menu's and the desired page is displayed. Similarly to many friend finder sites whereby you can select the age,sex and country of the person you are searching for. Is there a way to do this without needing a database ?
Multiple Drop Down List Problem And MySQL
I am trying to populate around 30 drop down lists via a single query to a mySQL database. The problem is how to make sure that each drop down list only display it's relevant data. for example the table is as follows:
Filtering Selection In Multiple Drop Down Boxes
I want to allow a user to conduct a search on a database using multiple drop down boxes. On the first page they will have a drop box filled with records from field A. Once they select which one they want, a second drop down box will then appear with records from field B which are present for field A (a filter). What I want though is that the first dwon down box still appears on the second page, but shows the record that the user selected. What is happening now is that when the second page comes up, the first box shows the default selection rather than the selection that the user chose. My code for the drop down boxes is: PHP Code:
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.
Dynamic Multiple Input Processing
I am creating a simple "or so I thought" php/mysql survey. There are 3 types of Surveys, with different questions. 1 for Clients, 1 for Employees, 1 for Peers. Questions for each survey are created, editable, removable, and drag/ drop sortable. Options to these questions are dynamic themselves. Basically, everything works except when I try to Insert the data into the answers table. The one question I'm looking for is how would one process the data based on the respective question_id's? Sending it to another page would require an excessive amount of _POST variables, and like i said before, there are different questions for each survey. or would this work? (it doesn't seem to process) if($submit){ for($i=$start; $i<=$end; $i++){ $query[$i] = "INSERT INTO answer(ansresult, ansdesc, idquestion, idsurvey) VALUES('q_$i','exp_$i','$idquestion','$surveyType' )"; $result[$i]= mysql_query($query[$i]); if($result[$i]){$success++;} } $msg = sprintf("Success: %d, Questions: %d",$success,$end-$start); echo($msg); }
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.
Selecting Multiple Dynamic Checkboxes From A Database
I have dynamic checkboxes with values populated from a database table and want to set the boxes to selected based on values from another table. Basically, I have a table of users, a table of categories (populates the checkboxes) and a table that is populated when multiple categories are selected per user (the table used to set the checkboxes to selected)..hope this is clear..Its for an 'Edit user' page, displaying the info for the user. 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.
Drop Down Lists Changing Depending On Other Drop Downs
I want to have a drop down system like this one. But without the radio buttons. I want to have 3 drop downs but have no idea how to go about it. I assume I will need to activate some sort of Javascript on the onChange event of the option drop downs.
Dynamic Form Fields/multiple Page Form?
It is for a friends out of print booksite, where visitors can request multiple books to be searched by adding one at a time to a cart (javascript), then once all added they submit to another form where they enter their personal details and all is sent through. The problem is at the moment they cannot change whats in the cart without refreshing the browser window and losing everything. 1) present for asking how many books they want to search for 2) display multiple rows of the same input fields depending on how many books they say they want to have searched for?i.e title|author|publisher|etc title|author|publisher|etc title|author|publisher|etc 3) when these are submitted they could see these above the next part of the form where they enter their details with the option to go back and delete/amend. 4) send all the info to my colleague. if so has anyone seen a similar script that I could take a look @ to see if I can hack it to suit my needs?
Selecting Multiple Values From Multiple Tables Using Checkboxes
I've been struggling with this for a bit but cannot seem to find a simpler, cleaner way of doing this. a. I have a Table A - Customers , Table B - Contacts . b. I have a form where a user types the first few alphabets of a customer name and then gets a list of contacts, cities. c. The user is supposed to select multiple options from this list and then send that data to another form for processing. I'm able to only pass data from Table A, not from B . Could someone please have a look at the 2 snippets of code and advise? And is there a way both these php scripts could be combined in a single one ? Code:
Grabbing Data From Multiple Tables For Multiple Requests
Here's what I'm trying to get at. A table that displays all the Process Server's name, the number of summons's he has out within 7 days, 7-14 days and 15+ days...pretty simple, it's just a report so management can stay on top of how many papers are out. I've got the server_information table with the server name and ID. and a case_information table with the serverID. I've got a while loop that displays all the server's name, the problem is when I try to get the # of cases....here's what i've got so far. Code:
Multiple-combo - Multiple Mail Recipients
I am new to scripting but trying to create a page that lets users create an e-mail (mailto after having chosen from two drop-down menus (arrays). I have managed to do so in HTML by using a Java script borrowed from Randall Wald (http://www.rwald.com). However, I don't want the e-mail addresses to appear in the page to avoid spam. Is there a way to do so by using PHP? P.S.: The first array contains (University A, University B) and the second array (Faculty, Staff, Students), i.e. 6 different e-mail addresses
To Search Multiple Words In Multiple Fields
I have a $phrase made of some words.Every query has a number variable of words. I would sort of my_table all records that have at least 1 word of the $phrase into field_a AND/OR field_b of my_table.
Multiple Users, Multiple Tables, One Form
I have a small group of users that will submit their 'goals' via one form (placed in a postnuke block). I have created one table (mysql) for each user to collect collect their goals. I need some direction in writing the php that will submit the form data to the correct table based upon the users Postnuke login.
Multiple Multiple Select Boxes
I'm looking to have multiple multiple-select-boxes on a page. But I can only get the contents from the last selected value within a box, via PHP. I've tried numerous methods. What am I doing wrong? You can see ALL the values present in the url: http://myserver/test.php?notify_use..._updcats=Update e.g.......
Drop Down Box
I have a drop down box that I have coded to have several values. These values are actually snippets for SQL code. how do I make the drop down box display the selection picked by the user after the page is refreshed?
Drop-down X 5
I am trying to populate a drop-down from a database and repeat this drop-down five times. The first drop-down gets populated but the others don't. I tried to reset the array, but I am still new to PHP and not sure if I am doing correct. Code:
Drop Down Box
The purpose of this application: I need 2 combo boxes, one with months, and one with years. When the user chooses both a month and a year, a page is displayed with certain numbers that are retrieved from a database. Those numbers correspond to the specific month and year. For example, January 1998 produce "12", but February 2001 might display "73". So I guess I'm asking 2 questions. The first is just a general outline of how someone might go about doing this (to see if i'm on the right track in my thinking). The second, and more important question is for someone to please explain to me how do I get the values chosen in the drop down boxes to correspond to specifc fields in a database?
Drop Down Box
i've got a drop down box that is populated by the results of a mysql querie but for some reason it only shows the first word. so if i have the results; test 1 test 2 test 3 it will just display test, Code:
Drop Down Box Other
Im trying to create a drop down box which at the end has a Other option. If Other is selected I want the variable which is set from the drop down box to be set to whatever is typed in, in the input box below by the user e.g: <select name="team_name"><option value='' selected disabled>Select Team Name</option> <option value="1st XI">1st XI</option> <option value="2nd XI">2nd XI</option> <option value="3rd XI">3rd XI</option> <option value="Other>Other</option> </select> I dont really want to use Java or AJAX, is there anyway in which this can still be done?
Drop Down Box
I have a couple of drop down boxes which you select the option you want, that value is then stored in the database. If you make a mistake there is an edit option which once clicked shows the form with the information filled in/selected. However my problem is that when you edit, although the current option which was previously entered into the drop down box is set as the starting value, which is disabled, if you dont change the drop down box the value is deleted rather than held as it hasnt changed. Code:
One Drop Down Box Effecting Another.
I am trying to have one drop down box effected by another drop down box on one page only. I would like a user to select their state from a drop down box, then depending on what state they choose, I would like the list of cities from another drop down box to be displayed that are linked to that state in a mysql database. The purpose is to keep the list of cities to choose from small, they should not have to waid through a list which contains cities in other states.
Drop Down List
I want to read a directory for available files and then get the filenames and put them in a drop down list. Whatever the user will select will be the value of the variable $selected. I already found the code to read directories: Code:
Selecting From A Drop Down Box
I have a drop down box populated with names of towns from my db (MySQL) all that is working fine. My problem is I do not know how I select a town in the box and have it take me to that web page on my site.
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:
How To Get Value From Drop Down Box To E-mail With Php
I have a form that includes a drop down box. I can get all of the other values to show up in an e-mail except for the drop down box values. Can someone please help? -- I know the HTML isn't the greatest. The website was originally created in FrontPage and the form broke. I'm just trying to help out and fix it for a friend. sendmail.php ....
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:
Drop Downs
trying to get dropdowns to appear and getting no where! I have a script with a config file that has a list of options. I have added a list of ages like so: $age[0]= 18; $age[1]= 19; $age[2]= 20; I now want to include these in a page in a drop down menu and have tried this code : $ageshow .= "<option>$age</option>"; echo "<tr bgcolor =$bg2>"; echo "<td class="classadd1"><div class="maininputleft">Age:</div></td>"; echo "<td class="classadd2"><select name="in[sfield]">"; echo "$ageshow</select> "; echo "</td>"; echo "</tr>"; this does not list the ages but just has array in the drop down. What am I doing wrong?
|