Smarter Way Of Doing Dropdown List?
I've got a dropdown list that is acting as a filter on a table, so the user can select a value and the page is reloaded only showing the matching values from the database.
Now when the page reloads the dropdown was set to 'all' as it was first in the list, even if I'd selected a different value, this was confusing for users, so I added an initial <option> field which pulled the correct value from $_GET (code below) - however this is a little odd as it means the value appears twice!
Does anyone have a genius solution to this? I've seen a <select selected="yes"> sort of thing around, but I don't know how I can tell the php to add this value dynamically?
<select size='1' name='occupation'> <option>".$_GET['occupation']."</option> <option value='All'>All</option> <option value='Student'>Students</a></option> <option value='Professional'>Professional</option> <option value='Hobbyist'>Hobbyists</option> </select>
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Dropdown List
I have a Dropdown list with Select with 1, 2, 3, 4, after select on of them it bust to refresh the page to what you select but it don't do it. PHP Code:
Dropdown List
i am trying to get two dropdown lists working on a page. How do i go about this. For example, I have 1 table which holds countries and cities. When a user selects a country in the first dropdown list, i'd like the second dropdownlist populate with a list of cities etc. from my database.
Populating Dropdown List
I am wanting to know how to populate the <SELECT> dropdown menu with all existing values from the DB and also have the value associated with that id selected. This is an updating area of my admin. Any ideas? Here's the code so far. At the moment it only retrieves the value assigned to that id. PHP Code:
Autopopulate Dropdown List From Database
An events-registration page with a form containing a dropdown list for upcoming events, the events will be pulled from a table which is updated by...? what i've gathered so far is that this can be done with PHP. I am a little unclear on the concept of how this is done. How does the updated information get input into the table? 1) can this be done (updating database) through a web interface by the client, or is it something i would have to do locally and then upload. If done by the client, can he delete/edit existing information--assuming he is not familiar with code. 2) what other things aside from html(good), sql(so-so), and php(newb) will i have to know? i've seen a lot of good tutorials here and will have access to the necessary software. I just want to know if there is anything else i should know before i dive in head first without testing the PHP water, which i assume is frigid.
Dropdown List Of Files In Folder
I am preparing a form that includes a drop-down list consisting of the names of files in a certain folder on the server. I only need to trap the file name (jpg), not the path and I'm not trying to upload the files or anything - simply allow the user to select one of a number of different image files (they're actually location maps).
Dropdown List - Trying To Get Default Populated From Db.
Nooby question but when I try and get this to work (it should identify which rows in the database have GK, MID, DEF, FWD against them and then put SELECTED into the option value to give a default of what the entry is currently) it just adds SELECTED to all the results as if $row["Position"] is returning true against all four conditions? What am I doing wrong? CODE:..
Cascade Dropdown Or Conditional List
I would like to create a conditional cascade form. based on the selection, it can display or not display an input form for the user to enter an string of text. then at the bottom of the page (or when a user submit) connect all the sections including the input field all together (it's like a story maker?)
Microsoft Access Dropdown List
l am building a new site using PHP which has a lot of pages pulling from an Access Database. I would like to have a dropdown list that pulls exhibitions from the database and then when the user selects one it shows the rest of the details from DB just below the dropdown list, hope that makes sense. Code:
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.
Easy Comma-delimited List To Dropdown Box Converter
I was working on a simple converter when I realized that by not setting the id param of the option tag, it wasn't going to send the value of the dropdown box to my php script. I had this to start with: Code:
Dynamic Dropdown And Hardcode Dropdown In Select Form
I have plenty of examples of dynamic dropdown choices but none of hardcoded dropdown choices. The ultimate goal is to have a job with various tasks and to track the status of those tasks for a given job. I've used one of the tutorials here to begin the process. Below is the code I have to add work on a given task. Perhaps I actually need to "Update" a job as opposed to "add". But the problem of the moment is I can't seem to hardcode one set of my options. This is the code I have: PHP Code:
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 = Ƈ') 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?
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.
Looking For Dropdown Help
I have a dropdown in which i want it to open a soundfile when selected. So, how do I go about this. The form will get submitted, and through a series of conditional statements it will point the right selection to the right if statement. but what do I put in the if statement to get it to open a realplayer with my ram file?? Here's what I got so far. Code: <FORM ACTION="<?=$_SERVER['PHP_SELF']?mode=changedropdown?>" METHOD="POST" NAME="sermondropdown"> <P> <SELECT NAME="sermons" SIZE="1" onchange="this.form.submit();"> <OPTION VALUE="pleaseselectasermon">Please Select a Sermon <OPTION VALUE="082403Daniel_1_1-8">August 24, 2003 Daniel 1:1-8 <OPTION VALUE="083103Daniel_1_1-8">August 31, 2003 Daniel 1:1-8 </SELECT></P> </FORM> <? if('changedropdown' == $_GET['mode']) { $selection = $_POST['sermons']; if (?Daniel_1_1-8' == $selection) { } elseif (?Daniel_1_1-8' == $selection) { } ?>
Dropdown
I have a dynamic drop down that needs to be populated from different columns in a database. The problem I'm running into is that sometimes fields do not have a value. So I would rather those didn't print out. The code below prints out the blank fields. I know I need to loop through and check for an empty value, but I'm drawing a blank on the how part. Code:
Dropdown Possible With PHP ?
i'm looking for a way to do the following : 1. selecting data from a MySQL database 2. putting one field into a dropdown 3. after selecting a value from the dropdown follow some more php code step 1 is no problem, step 2 is no problem with the html select statement however this leaves me on the client side. After this i'm not able to return to the server side to execute some more php code, with the onchange attribute i can start some javascript but i want ( read need ) to use php code. Concrete question : is there a way to create a dropdown in pure php code ?
Dropdown Box
I currently have a dropdown box on a page. What I would like is that when a user selects something from the dropdown box it automatically changes the display of another box.
Value In A Dropdown
I have a piece of code where I get the player_id value from the url at the top of the page. Rather than this I want to get the value from variable named $player_one. Code:
Dropdown Box And A Query
Heres my situation: In a form I want to read the categories listed in table $inv_table and present them in a dropdown window so the viewer can choose and add to a different table. The script below works with one glitch. There is a huge white space on the page above the dropdown box. This will get me by but it isn't too purty. <td valign="bottom"> <a name="theform"> <select name="catname" size="1"> <? { $result = mysql_query("SELECT DISTINCT category FROM $inv_table ORDER by category",$db); while ($myrow = mysql_fetch_array($result)) { echo "<option>".$myrow["category"]."</option><br>"; } } ?> </SELECT> </td>
Dropdown Menu
I want to upload a feild values into a dropdownmenu. can anyone help me how to write in php code.
Dynamic Dropdown?
I am posting a code for dynamic dropdown by Leon Atkinson, it works fine but i have a doubt: I tried to add another functionality to it where i got stuck! Once the city also gets selected from the second drop down i wanted that on clicking the submit button it should go to some html page wrt to the city choice. Code:
Dynamic Dropdown Box
im looking to have two drop down boxs one with makes of car and the second drop down box to automatically populate with all the model of that particular make of car. there are about 50 makes and upto 50 models per make. I just would like to know the best way to do this - javascript or use a database? it would be a lot of code todo it in javascript wouldnt it?
Dropdown - Default Value
I want to be able to have a drop down list that doesn't necessarily have the first item as the default. The content is being populated by PHP so I have no idea how to do it.
Php Dropdown - Selected?
i'm using this to pull information from a database and display it in a dropdown list. The problem is I am using the name code when I goto the "Update" page, but i'm not sure how to add the "selected" field, that way what ever I saved in the database will load. Example: I goto add and it add's the "id" of 7 to the field, when I load the page again it auto's back to 1 instead of clicking in-to 7 as thats whats already there... = ) Code:
MySQL Dropdown
Is there a way to make a dropdown by getting the options directly from the database? And I'm using this as a form so it has to have a name so I can call upon the value and do something to it. Example to what I want to do: - I have a database table named members and in that table, it has 3 columns - name, age, sex. What I want to do is make a dropdown inside a <form> using the data from the database. And then when the person selects the name of the member and presses submit, it deletes the row with that name from the table and the database.
Change Dropdown Value
i've two dropdown fields 1) products - (mobile phone, camera, webcam, tv, dvd player and etc 2) accessories how accessories field can be changed if visitor selects product. for example: if visitor selects TV, accessories field should automatically changed with cable wire, electric board and etc (without reloading) another example is www bestessays com/order.php when you'll select "Thesis" from type of document, urgency and cost per page values will be changed.
Months Dropdown
I'm looking to do a dropdown with the months in the year starting with this month and going on for 12 months, ie. the selected month is April 2007 and the last month is March 2008, does anyone know how to do this using PHP?
Last 3 Months Dropdown
I need to come up with something that will take the current month, for example this month is april. It would create a drop down list like Feb 1 - feb 30 march 1 - march 30 April 1 - April 30 Basically the last 3 months, including this one. Then I am going to need to save the month as the value, so I can pass it to the script so I know what date ranges I am looking for. I can't think of a logical way to do this, and still account for the fact that some months have 29 days, some have 30, and some have 31.
Remember Selected Value DropDown
I am attempting to have a drop down menu that displays url from 1 table called links the same table also contains a name for the url. i.e. google.com = name and http://www.google.com = url The value of just the url from links is stored in a separate table called users in a field named search after form is submitted by user. Everything Posts correctly except when go back to edit the record and submit the form the drop down box does not retain the value of what had been previously selected although it is the correct record until form is updated when whatever value is currently in the drop down list will update the record. I know the code is doing exactly what it is told to do, because I have no functionality in it to recall the value from the field search in the users table. I don't know if it is something I would have to add to the array or option value. I can get it to work if it is all hard coded, but I am attempting not to do this. I am pretty new to php mysql and any help is greatly appreciated. This is the code I am working with that came mostly from a tutorial. PHP Code:
Maximum Dropdown Size
I have a strange issue with dropdowns. Using php4, mySQL5, Apache 2 on a fast XP pro PC, I have a form which requires 5 dropdowns populated with indentical values. I extract the values using SQL and populate 2 variables and use a for-next loop to create the dropdown. The dropdown contains some 310 items! It works beautifully if I have 1 or 2 dropdowns but as soon as I add more it partially creates the 3rd and just stops until it times out! All 5 work because I have altered their positions but it always stops part way through creating the 3rd dropdown. I tried an alternative method by doing away with the variables and constructing the dropdowns with a 'while' statement reading through the results of my SQL and got exactly the same problem only 2 and a bit dropdowns. Stopping it running after a few seconds or several minutes makes no difference, it seems to reach a certain point and just stop - no error messages or anything! I have tried increasing the resourses in my php.ini file but this also made no difference. Can anyone suggest an alternative or a fix?
Dropdown Lists From A Mysql Db
Id like to load a drop down list from a mysql database using php3 and create a link to that record. Does anyone have any ideas?
Advanced Dropdown Menu
I want to populate a dropdown menu with countries that are in one column of my table. I know how to do that, but I can't find how to eliminate multiple items. Some countries appear several times in different rows, but I only want each available country to be shown once in my dropdown list.
Mysql / Dropdown Menu
what i am trying to do is to make a system with a few input pages and edit and read pages.. so right now i got the input/edit/read pages working. (yay) But now I want to have on 1 input page a dropdown menu that reads its information from the database. and that if i go to the page i can select a value out of the db and submit that inside my form and that it reminds the value if i view or edit the page. So what i got now is a little system that is able to add/remove/edit a value inside a field called "drop01" Well now i got a other input page called "input01.php" inside this script i want to have the dropdown menu that reads its values from the "drop01" field. PHP Code:
Autoselecting A Value In A Dropdown Menu
I'm revamping my sites administration panel and I put in a dropdown menu to select the section to administrate (it was a LOT better than the list of links I had before, I'll probably update it some more though) and I want to know how I can autoselect whatever page I'm on in the dropdown menu, for example, here's the menu: Code:
Multiple Dropdown Menu
i attemp to design a drop down menu that call up data from a table for each drop down menu. Code:
Update Dropdown Instatly?
I have 2 dropdowns on one page, and well the second is controlled by the first. What I want is the first dropdown to select the value and then an instant MySQL statement to populate the second dropdown..
Populate Dropdown W/o Submit
Ive got some arrays; one array is most of the U.S states. the other arrays are names of clinics my company has within the selected state. I want to be able to select a state from a drop down and have another drop down next to it that will populate itself automatically.... without having to press a submit button.
Calling Dropdown Data From Db
I want to call data from the db and display it in a dropdown and make the selected option match the value of the record called. It thats clear? Code:
Dynamic Dropdown Lists
I am recoding a greeting card website. I am using dropdowns as filters for items in a DB, so when the user picks "animals" from the "theme" dropdown, the returned cards all feature animals, and when the user picks "birthday" from the "message" option, the returned cards all feature birthday cards. However, there are some combinations that don't return any results, for example "get well" "floral" cards. Code:
Empty Value In A Form Dropdown
Think that we have one dropdown form where we can choose countries from like this. <select name="country" id="dropdown"> <option value="Choose country">Choose</option> <option value="USA">USA</option> <option value="CANADA">CANADA</option> IF I have an SELECT I can easily set country = '$country' IF user have choosen some country, but when user not choose any country the selected one is "choose", is it possible do add All countries to $country so the SELECT formula include all countrys and not just get empty?
Classes And Dropdown Lists
The class below works fine. The problem I have is there's a dropdown list in the middle of the loop. The dropdown list gets its data from another table in the database. Which goes through the same class. So I have a loop within a loop. What I'm trying to do is ....
2 Questions. Dropdown Menu And # Of Rows.
1. I have a table named pics and a column named name, just to let you know for use. I want to take the data from each row in the name column and insert it into a dropdown menu. I know how I could do it, but I would have to go: Code: <SELECT NAME="name" SIZE="1"> <OPTION SELECTED><?php $name[10 ?> <OPTION><?php $name[1] ?> <OPTION><?php $name[2] ?> <OPTION><?php $name[3] ?> <OPTION><?php $name[4] ?> <OPTION><?php $name[5] ?> <OPTION><?php $name[6] ?> </SELECT> but then I could make too many or too less. I want it to automatically adjust to the number of rows. 2.What is the code needed to find out how many rows are in a table?
Changing Text On Page Via Dropdown Box.
I have a webpage that draws various text decriptions from a mySql database. The description displayed on the page is controlled via a dropdown box. Currently I am using Javascript with a dropdown box (onChange handler) to change the value of a textbox. Can anybody think of a way that I don't have to use a textbox(with its' scrollbars and background)? How can I change the value of a php variable by changing the selected index of a dropdown box?
Newbie: Getting Index From Dropdown On Onchange Into Php Var
This is very new to me, scripting languages. I am trying to get the /select id off of a dropdownlist, which really does not drop down and is more like a flat list??, at an onchange event. Then move it into a php var to retrieve different data from db. Not that it matters but I load about 1200 items in to the list and was surprised how fast it is. Could some one give me some direction? // // Handle the data coming back echo "<FORM NAME=author>"; echo "<SELECT NAME=author_pk SIZE=20 COLS=20 ONCHANGE=getPK()>"; while ($rows = mysql_fetch_object($result)) { echo "<OPTION VALUE=".$rows->id.">". $rows->TITLE." ". $rows->lastname.", ". $rows->firstname. $rows->middlename. $rows->SUFFIX. "</OPTION>"; } echo "</SELECT>"; echo "</FORM>"; echo "<script language=Javascript>"; echo "function getPK() {"; <? $location ?= "document.author.author_pk.options[document.author.author_pk.selectedIndex].value "; echo "}"; echo "</script>";
|