Query From Db, Add Values In Dropdown Menu
i wanted to query my db, and then add values to drop down menu, where when they select what they want in the dropdown, it will bring them to another page accounts.php where they will have more options.
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
[PEAR:QuickForm] Dynamically Change A Dropdown Menu According To Another Menu?
I've been using QuickForm for a few months now and I am now given a new challenge: I've got a search form with a dozen of dropdown menus, the first dropdown menu being "Brand". If you select either Brand A, B, C, D... Z, the second dropdown menu "Model" must be dynamically changed to model AA, AB, AC, AD..., according to the models manufactured by the brand selected in the first box. I've seen that done on quite a few sites, but never found if QuickForm had a quick & clean way of doing that.
Dropdown Menu
I want to upload a feild values into a dropdownmenu. can anyone help me how to write in php code.
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:
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?
Unwanted URLs In URL Dropdown Menu
I'm working on a PHP script and it has a user login, and the variables (username, password, id number) are passed via the URL bar. Is it possible to somehow not allow the visited page show up in the dropdown list of URLs in the browser? The problem is that people can view the list and easily see people's usernames and passwords. Example: http://www.somesite.com?username=john&password=12345 What I only want is: http://www.somesite.com/ I know that Hotmail.com doesn't show all of the pages that have been visited, all it shows in the list is hotmail.com, so I think it is possible to do this, but I don't know how.
Make A Dropdown-menu Filter?
I have a dropdown menu which is supposed to filter a table to show results for professionals, students or all. But I don't really know what I'm doing. This is what I have so far. Code: Initially, I was able to filter for students or professionals, but since trying to have an all option (students and professionals) it has gone to pot, and I keep getting errors. I know that my quotation marks are not right, but I can't think of a solution. I would be more than happy to see any ideas, even if they are completely different to mine!
Dropdown Menu <selected Name="...
I have a dropdown menu like this one: <select name="country" tabindex="6" id="select_country"> <option value="">- Country List -</option> <?php $query = "SELECT * FROM country ORDER BY country ASC"; $result = mysql_query($query) or die('Error, query failed'); while ($row = mysql_fetch_array ($result)) { $country = $row['country']; ?> <option value="<?php echo $country ?>"><?php echo $country ?></option> After I have selected one country and I hit the submit button it go back to the default value in the box, what I want is to show the selected value in box until I selected another value. If the default value is Australia when I start this page, I then select USA and hit the submit button it reset to the default value "Australia", but I want it to show USA as long I not select anything else. I have tried to use session in selected="<?php echo $_SESSION['country']; ?>" but it didnt work.
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.
How To Pass The Value Of Selected Dropdown Menu To Another File?
there is a php-myql script that list the mysql databases in the drop-down menu, use wil select one and the submit button should pass the value or variable $db_name to the test.php, this script list the databases in the drop-down menu but when i select one and then click on submit cannot pass the db_name to the test.php:
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>
Populating "Month" Dropdown Menu
I can get the current month to display in a text box by inserting value="<? print strftime("%B"); ?>"> into the code for that particular text box on a form but how can I populate a drop down with names of all the months with the current one being 'default' as it would be in the text box example?
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.
Passing Values Using Drop Down Menu To Same Form.
how I am able to do this without the use of a "submit" button - ie onchange. Here is what I am working with. <form name="form1" method="post" action=""> <select name="MyNumber"> <option value="One">One</option> <option value="Two">Two</option> <option value="Three">Three</option> <option value="Four">Four</option> <option value="Five">Five</option> </select> <input type="submit" name="Submit" value="Submit"> </form> <?php @print ($MyNumber);?>
Query Using Drop Down Menu
can i query a table based on a drop down list? i have a list of agents that i just want a simple drop down list to show the records they entered.... right now i just have the entire table showing all records in a html table format...but i want a drop down list so that if they only want to see the ones they entered, they can just select their name and poof...only theirs are shown...
Simple Menu, MySQL Query Question
I'm creating simple menu. MySQL: +----+-----+----------------------+ | id | sid | Title | +----+-----+----------------------+ | 1 | 0 | Main Menu 1 | 2 | 0 | Main Menu 2 | 3 | 1 | SubMenu 1 of menu 1 | 4 | 1 | SubMenu 2 of menu 1 | 5 | 1 | SubMenu 3 of menu 1 | 6 | 2 | SubMenu 1 of menu 2 +----+-----+---------------------- What should be my query? I'm trying to select all titles, and display them: Main Menu 1 - SubMenu 1 of menu 1 - SubMenu 2 of menu 1 - SubMenu 3 of menu 1 Main Menu 2 - SubMenu 1 of menu 2
Drop Down Menu Where The Items Are From A MySQL Select Query
I am just starting programming in PHP and wonder if it is possible to have a drop down menu where the items are from a MySQL select query. I am registering people for a weekend seminar and want to have a list of valid weekends to choose from on the form. Any pointers to scripts or PHP references that will help would be appreciated. I am using the book "Build your Own Database Driven Website Using PHP & MySQL" to get me started, but also need recommendations for a general primer to php.
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:
Getting Values From A Textarea To Use In A Sql Query
im trying to retrieve the text entered within a text area, split it into indiviual lines and use each line within a sql statement I can retrieve the values but only the 1st value is inserted within the sql statement Code:
Adding Values In One Column From Query Results
I have this query: SELECT *, sum(field_value) as totalValue FROM table_name WHERE field_id = $id GROUP BY field_group the data type of field value is a decimal value, with values such as 125.00 and 150.50 stored in each record. My goal is to have totalValue be the total value of those numbers. So if I have two records that equal 125.00 and 150.50 totalValue would = 175.50. the above query does not do this. What do I need to change here? Should I try to do this from the PHP side?
Query String With Multiple Values In One Table
I'm having trouble with the syntax on a query string, and haven't been able to find any posts or tutorials that seem to address this specific type of query. I have a table named "items" with a field for "name" In the "name" field, I have several different entries (actual data), including John, Mark, Sue, Brian, Lucy, etc. In the specific page I'm building, I want to query the database and return the data for more than one person, but not everyone. It seems the query string should be: $query="SELECT * FROM items WHERE name='Brian' AND name='Sue' ORDER BY name ASC"; However I get errors. If I remove the "AND name='Sue'" it returns data for Brian just fine, and if I remove "name='Brian' AND" it returns data for Sue, but I can't get it to return the data for both of them.
Reloading The Page With Updated Query String Values
I'm trying to build a small portfolio and instead of using several HTML pages I wanted to just use PHP. What I have is an array of each image's path (for the "src" attribute). I was thinking when I click "Next" (a text link) it increments the array and once it has reloaded itself it would simply look at the query string then display the new image. I have some questions though: 1. What line do I use which will reload the page with the new incremented variables? 2. When the page reloads itself, will it automatically get the new image to load? I already placed $thisimage = $_GET['imagenumber'] at the very top so it updates the "src" attribute for the image.
Adding New Values To An Array That Already Contains Values..
is it possible to append new values to an array that already has values in it?? say, i have my existing array; existing array; $array = array([66314] => 66314 , [66315] => 66315) ; then , when i check my checkbox on my next page, the ids should be appended to the $array: array that needs to be added to the $array; $array = array([66316] => 66316,[66317] => 66317,[66318] => 66318); how should it be done??
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 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:
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.
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.
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?
|