Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





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.




View Complete Forum Thread with Replies

Related Forum Messages:
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:

View Replies !
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?

View Replies !
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:

View Replies !
MySQL, DropDown, PHP, Form!
Well I have this mysql database with some passwords. Now I have a form where a dropdown list is populated with the name of the users (there are repeated names).

Well what I'm trying to do is after selecting an user in the dropdown list, the post will be directed to a result form where I'll have again the name of the user and now his password (for that exact row). Code:

View Replies !
Mysql Dropdown List
Im trying to automatically fill a dropdown list with data from MYSQL table.

Sizes Table
--------

ProductId | size1 | size2 | size3 | size4 | size4 | size6 |

* the 'size' rows hold a numeric value for the quantity I have of each

I was hoping to only list the sizes that have a greater number than 0.
I have used an auto fill select code on another project but I'm just not sure how to fill in the blanks. Code:

View Replies !
Dropdown & Mysql-tables
I know how to create tables in mysql, thats no problem. I want to use a table with users-information; name, class, email, id and so forth. Then I would like a table with info about events; name, data...

What I want is this; when registered users come to the site they want to signup to these events and they want to select events via a dropdown-box. They chose an event and clicks a button and its stored in the db that they want to go to that particular event.

Now, in php and mysql, how is that done? I dont know how to setup the layout for the tables. And I think Im missing some in the php to.


View Replies !
Populating Dropdown With Mysql Entries
I would like to create a combobox in Flash which is populated with mysql data and programmed with php. For example: There are 3 entries in database .ie. apple, bannana, peach. Now these I want in combobox in Flash MX/flash5.

View Replies !
Mysql Php Display Column In Dropdown?
is it possible to show a column from mysql in a dropdown and then when that row is selected to display the information in an editable form ??

View Replies !
Dropdown Populated From Mysql Field
I'm looking to create a drop down box that displays a field from a a mysql DB so that i can list all the names and when I select a name from the list it selects that record.

View Replies !
Mysql Dropdown And Text Box Scenerio
I have on my web site a facilty where a user can change their trainer name. So 'bill' can change trainer from 'trainer1' to 'trainer4'. that kind of thing.

Currently bill would select the trainer from a dropdown menu where the menu is populated from a mysql statement of available trainers.

How would I create a facility where bill can either select the new trainer from the list or enter an entirely new one in a text box.

View Replies !
Dropdown List - Insert Into Mysql
I simply want to add a dropdown list where, when an option is selected, its value will be inserted into a dbase table. More specifically, asume there is a page where the user sees his order.

He will be able to select the order status (pending or delivered). So, for example, if his ordered is deleivered, by selecting "delivered" option, "delivered" will be inserted into the 'Status' column. Code:

View Replies !
Pagination And Dropdown Menu Used In Searching Mysql
I am working on building a database made for searching. I have a text search and a dropdown box used for searching different table collumns (lets people search for certan criteria). I have that working correctly.

I also only want to show 25 results per page. I have that working correctly. My problem is that when I combine the two it breaks the code. The pagination works fine without the dropdown and vice versa. I think it is due to the variable that is being used to choose the collumn in the sql query. Code:

View Replies !
Got The Dropdown Menu Populated From MySQL, But Not The Results After Submit
I have a dropdown menu populated from the MySQL database in a form. When I hit submit I want the results of the selection to be displayed. Code:

View Replies !
Date Dropdown From Mysql Date Entries
For the PHP gurus out there, here is what I want to do: create a dropdown list of available dates from a mysql database date entries. But the dropdown/s should have 3 separate fields in month, day and year which in effect shows only those months, days and years that have corresponding entries from the database.

Planning to use this in the archive section of an online news publication so people can select issues to view via dropdown list that have corresponding entries only.

View Replies !
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) {

}
?>

View Replies !
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:

View Replies !
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 ?

View Replies !
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:

View Replies !
Dropdown Box
I want to create a form with a default image and a below it, dropdown box and a series of options in it. When the user clicks on the submit button after selecting their option, the default image above the box is replaced and a title or caption next to the new image would appear.

For example the user might select 'option C' from the drop-down list. They then click submit. The default image would be replaced with the selected option or the page would reload with the new image and a title or caption next to the image.

View Replies !
Dropdown Box Is Too Big
I want to know the code to restrict the dropdown box to a certain number of characters as the data from the db is too big. I want it to display say 50 characters.

View Replies !
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>

View Replies !
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:

View Replies !
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:

View Replies !
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?

View Replies !
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.

View Replies !
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:

View Replies !
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.

View Replies !
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?

View Replies !
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.

View Replies !
Dropdown Menu
i seem to be having some problems on finding how this ajax drop down menu i seen at Anime-Eden.com.

it has a nice effect on how it appears. Now i am familar on how PLAIN drop down menu works, but not how this works.

View Replies !
Dropdown List Box
I am able to populate data in a dropdown list box using php and mysql. However, I a wondering if i can add inside some icons such as close or More records,  where the drop down acts to the specified request, ie., closing the drop down or fetching  some more data from backend.

View Replies !
Dropdown Population
I use the code below to populate a dropdown box from mysql, problem is it goes to the end of the table when it does its stuff. Each colmb in the table has different amounts of records. So if a colmb has less data than the colmb with the largest amount of data it fills the end of the dropdown box with whitespace.

<select name="Location1">

<?php

$query=mysql_query("SELECT $BusState FROM $locationtype");
while ($fetch=mysql_fetch_assoc($query)) {
echo '<option value="'.$fetch[$BusState].'">'.$fetch[$BusState].'</option>'
}
?></select>

View Replies !
Dropdown Lists
I've been doing a site for a while now that has several drop down lists in a form. On one form there is the same drop down list repeated 3 times from the same table in a database but with different values. What would be the best way to repeat the code without repeating all of the code. Basically looking at an more economical way to do things. Would you do a while statement and loop through them or maybe a single array and call it when you need it. Any opions?

View Replies !
Refreshing Dropdown Box
I did some searching here, and it looks like refreshing is what I need,but it seems that most posts were 2005 or older. Maybe there is a new way to do this?

I have a form that inckudes two dropdown boxes. One is Category and the other is Subcategory. To make things simple, let's say I have Fruits selected in Category.

Subcategory would have a list of fruits, like Apples, Bananas, Oranges. If one changes Category to Vegtables, I want subcategory to automatically refresh with a new list,like Beans, Carrots, Peas. What is the best way to do that?

View Replies !
Populate Dropdown
I've written a form for uploading data to a mysql database. To limit user error, I'd like one of the fields to be a dropdown of the contents of an image folder. I've got a dropdown of some mysql data taken from the database.

that's fine. And I can display the contents of the image folder in a big static block. that's fine too. But I can't seem to combine the techniques. point me in the right direction.

View Replies !
Dependent Dropdown
I have set up a MySQL database with 5 tables that are relevent to this question. The first table is for entering records, the second has only 2 foreign keys that join the first and the third together,

the third has a primary key for numerical value and a name column, that is used for the first dynamic dropdown list, the forth table, like the second has only 2 foreign keys to join the third table and the fith table and finally the fith table, like the third table has a primary key for a numerical value and a name column for the planned dropdown menu.

How I can get the first dropdown menu to work, how do I get the second one to run off it and the form or forms need to submit to 3 tables, how do I do that?

View Replies !
Use A Dropdown Menu
I have a list of contacts which are sorted by name. I was hoping to create a dropdown menu in which someone can sort the list of contacts by office, city, state, and contact type. Is this possible? (I am sure it is, but I am not sure what the concept is called so I may research how to do it).

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 !
Populating Dropdown Box.
I have been looking around the internet for an example of what I need to do but cant find anything was wondering if someone here might be able to help. What I need to do is to connect to a mysql db select a table and then a field from that table and put all the contents of that field into a dropdown box.

View Replies !
Making A Dropdown Box
I want it so when you scroll down my dropdown box and select number 4. it stays at 4, and doesnt go back to number 1.

View Replies !
Option Dropdown
Im trying to create a "Select all" search Option dropdown form , but the options are stored the the database. Heres my original form:

<option value="<? echo $rst["id"]; ?>"><? echo $rst["cat_name"]; ?></option>

Basicly it has 20 or so options,  but no "search all" option. I had a play and came up with this but its adding the "select all" option every 2nd field:

<option value="<? echo $rst["id=all"]; ?>">All Categories</option>
<option value="<? echo $rst["id"]; ?>"><? echo $rst["cat_name"]; ?></option>

View Replies !
Get Dropdown Values
I am having trouble getting the values from a dropdown <SELECT>list and using the selected value as a part of my SQL statement. Code:

View Replies !
Dynamic Dropdown
This may be rudimentary but I'm just trying to get my head around this without having to write a billion lines of extraneous code. I have a dropdown selection list, populated from a mySQL database, containing times in a HH:MM:SS format. The times are 30 minutes interval spanning an entire day, as in 01:00:00, 01:30:00, 02:00:00 all the way to 24:00. I have it entering fine into the database, but when I want to edit this time, I'd like to have the value in the database be marked as the CHECKED value on the dropdown so I don't have to manually re-enter the time for every edit.

View Replies !
Grab The Value Of A Dropdown Box
I'm using the following code to grab the value of a dropdown box called "category"

if($_POST){
foreach ( $category as $value ) {
echo "$value<br>"; }

How do I also grab the option id associated with the row?

<option id="$id" value="$cid">$name</option>

View Replies !
HTML Dropdown
I have a couple of forms on the same page: 1) a dropdown with 2 selections using the "POST" method followed by 2) a search form.

When I run the html, the dropdown works fine - when a selection is made the target URL is called and the POST method can be referenced in the target php code.

However, when I execute a search in the second form, the target URL for the search is NOT called - instead the dropdown URL is called. I tried to reduce the problem to the least amount of sample code, which is: Code:

View Replies !
Paginate With A Dropdown
Currently I am using a tutorial about paginating with the regular page numbers. How do I change this code to put the pages into a dropdown list? Code:

View Replies !
Testing Value Of DropDown Box
im setting the value of a dropdown box with :

$Result2 = mysql_query($Query2, $Link);
?>
<option value="" selected>All</option>
<?
while ($Row2 = mysql_fetch_assoc ($Result2))
{
?>
<option value="<?=$Row2['eFrom']?>"><?=$Row2['eFrom']?></option>
<?
}
mysql_free_result($Result2);
?>

Theres more around it just a brief snippet, it loads fine after this is loaded im trying to test the value of the selected field. and well it doesnt seem to want to test with the code below. ive been looking and i cant find the correct syntax to test it. here is what im using anyone know the correct way to test this? Code:

View Replies !
Dropdown Box With Search
I am seeking to create a page that has a drop down and depending on the drop down I choose allows me to search tables within my sql based on that chosen drop down. Similar to the one found at www.imdb.com but the drop down would be a list of the tables within the dba that the user could search.

The purpose is to create a search box where an runn can enter in his name or bib number and select the year he wishes to view his resutls. The search would then look within the table of the year selected and display the runners info.

I am not sure on how to accomplish this. If anyone knows of some resources that i can read or if anyone knows others who have done this and are willing to share knowlege.

View Replies !
Dropdown Not Selecting From Db
when I then goto edit a record, the selection from the dropdown is not selected from value in the db, it always shows Code:

View Replies !
Updating Dropdown
I can get the initial value with no problem but how do I update it once it changes. There is no form to be submitted, that would be an easy solution. I though that maybe I could do it with OnChange but can't figure out a way to do it. My code is below.

<td><select name="ShareCode">
<option value="" SELECTED>I am not sharing a room</option>
<option value="SpouseShare" <?if ($ShareCode == "SpouseShare") { echo "SELECTED";}?>>Sharing a room with a spouse</option>
<option value="ColleagueShare" <?if ($ShareCode == "ColleagueShare"){ echo "SELECTED";}?>>Sharing a room with a colleague</option>
</select>

View Replies !
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:

View Replies !
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?

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved