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.





PHP + MYSQL, Populating Drop Down Box


I am looking to generate a dropdown box from MYSQL data:

db name = h2, table = Working, Column = Home.




View Complete Forum Thread with Replies

Related Forum Messages:
Populating Drop Down From MySQL
I am trying to populate a drop down menu of MySQL data using PHP and I have hit a snag. I think its probably something simple that a freah pair of eyes could pick out right away that I am just not seeing...

For some reason only the "firstname" part of the data is populating in the drop down and I can't figure out why. When I try to make changes to the echo lines to correct this, nothing shows up including the "firstname" data. Code:

View Replies !
Populating A Drop Down From A MySQL Table
When they click submit, I want the name dropped from "invite" and added to a table "guests" with their answer if they are coming and how many. I know the SQL to make it happen, but I am pretty sketchy about the PHP. Code:

View Replies !
Populating Multiple Drop Down Boxes From Mysql Table
Am having a problem with a dynamic, multiple drop down box query. If I run the code with only one select, it populates fine. If I run it with 2 selects then only the first drop down box populates - the second drop down box is empty. Am wondering if I need to put the query into an array and populate the boxes from there. Code:

View Replies !
Populating Drop Down
How do I do this drop down box ? Making an edit page. I have 2 tables

groups
id || categoryname

program

id || cateogry_id

I need to populate the groups in it at same time show the selected choice from program. Not showing id but needs to show categoryname with of course the values being the id of groups.

View Replies !
Populating A Drop Down Menu
How would I go about populating a Drop Down menu from data in MySQL? If you can show me wither a URL to learn this, or if you feel like telling me here, that would be great.

View Replies !
Populating Drop Down And Table
I have a database with the following fields.
Name | Company | Date

values in each column could be repeated, or not. as in there could be several same names with the same company with different dates, or different names with same company.

How do I populate a table with this info and have drop down boxes, so that I can narrow down the search? For example:
Name | Company | Date
12     | 1           | 1929
13     | 1           | 1929
14     | 1           | 1929
12     | 2           | 1929
12     | 4           | 1929
13     | 1           | 1941
12     | 6           | 1929

So if in the drop down I select '12' under name, only those entries with 12 are shown, and then I can further sort it by selecting only '1' under Company.
Hope I'm clear, I manage to complicate things when I post them.

View Replies !
Auto Populating A Drop Down Box
Basically I'm setting up a website which needs an populated drop down box made up from all fields in a specific column of a table in a mysql db....

Here's the code I've made up using various tutorials....

<?php 
$user = "";  
$host = "" 
$password = "" 
$dbName =  "" 

/* make connection to database */  
mysql_connect($host, $user, $password) OR DIE( "Unable to connect 
to database"); 
mysql_select_db($dbName); //did you forget this line? 

$sql = "SELECT model FROM usedVehicles"; 
$query = mysql_query($sql) or die(mysql_error() . "<br>$sql"); //use the or die(...) part ONLY IN DEVELOPMENT 
?>

<form action="action" method="post"> 
<select name="option"> 

<?php  
while ($row = mysql_fetch_array($result)) {  
    echo "<option value="" . $row['model'] . "">" . $row['model'] . "</option>
";  
}  
?> 
</select> 
<input type="submit"> 
</form>

I've left out the connection details for obvious reasons... When I upload and try to test this, jus a blank drop down appears... there are definately fields in the column as I have tried the query on phpMyAdmin.

View Replies !
Populating A Drop Down List With Php
I am trying to get a drop down list to populate vbia php. What I have a is a script that allows a airline/user to enter airfare and price for tickets. It dumps them into a database and then allows the user to view/delete/add.

I want the user to be able to edit the airfare. I have a drop down list that is set as a variable $ticket_from, $ticket_to. The list contains around 400 cities. When the user clicks 'edit' I have the price population but no the drop down list. How do you go about something like that? I have this right now: Code:

View Replies !
Populating Drop Down Lists
Could anyone help me on populating database driven drop down menus. I am trying to populate a second drop down list based on the selection of the first drop down list. I have the first drop down list running. Not sure about getting the second now.

View Replies !
Populating Drop Down From A Query
I'm trying to populate a drop-down box from the results of a query. I end up with the first option coming through and then blanks in the rest. Something like this...

<option value=Acevedo>Acevedo</option>
<option value=></option>
<option value=></option>
<option value=></option>
<option value=></option> .......

View Replies !
Self Populating Drop Down Menus
i am trying to do is the following: I have a MySQL database that (very simplified) has a schema like this 'Students(Name, id, Course)' I would like to have a form on a web site that has 2 linked drop down menus, one 'Please select id' and one 'Please select course'. When a user of the site selects there Id from the first drop down menu, i want the second drop down menu to populate itself with the courses held in the database for the given users Id. I would like the first drop down menu to be populated from the database with a query similar to 'SELECT id FROM students'.

View Replies !
Populating Drop Down Menu
I use the following code snippet to build a drop down menu with the
results of a query. How can I set the initial value of this input based
on the result of another query?

What I am trying to do is update records in the data base. The field
WkEndDate is pulled along with the rest of the record and the drop down
menu is built from a table of valid WkEndDate values. Code:

View Replies !
Populating Drop Down Fields
I am trying to populate a drop down menu with a mysql database. I was hoping to have a selection of months in the dropdown menu, based on date fields in my database when a user then selects a month, they will be brought to a new page that will have only the records created in that month. But in my database, the date is stored in this format: 2006-05-12 00:00:00 if you need to see my code, here it is:

<?
//database connection
$query = mysql_query("SELECT * FROM casinocredit");
// start to print out the form
echo "<form action="cats.php" method="POST"><select name="clients"><option value="" "selected">Select A Client</option>";
// loop through the records
while ($row = mysql_fetch_array($query))
{
echo "<option value="{$row['ID']}">{$row['ddate']}</option>";
}.........

View Replies !
Populating A Drop Down List With The Year
i'm trying to loop the years from 1960 - 2010 with the function get_year() below:
PHP Code:

View Replies !
Populating A Drop Box With Results From Database
I have a MySQL database with a table (category) with two fields, catId (int) and category (char(50)). What I want to do is to get all category names in this database and place all of them into a dropdown box on a web page so that the user can choose from the list of available categories.

View Replies !
Populating A Drop Down Via A File Directory?
I just wrote this code:

$dir = "/images/news";
print "<select name='file'>";
$dir = opendir($dir);
while (false !== ($file = readdir($dir))){
if (in_array($file, array(".", ".."))) continue;
print "<option value='$file'>$file</option>";
}
print "</select>";

But for some reason it is not populating. It instead echoes an empty drop down menu. Can anyone suggest anything?

View Replies !
Populating Drop Down Boxes From Database
I have two drop down boxes, the first one i am able to fill from my database using the following code. Code:

View Replies !
Auto Populating Multiple Drop Downs.
im trying to create two dropdowns, i need the first one to be the category and the second one to be the subcategory.  The category drop down autopopulates with the correct info from the database. and uses the table "category", the value of each drop down is represented by the "cat" field in the table (cat is basically and integer id number) and "Category" is used as what the user actually sees in the drop down (category is the actual word of the category).

Once the category is selected i would like to have the sub category auto populate with everything that has the same values as the selected category (cat)

Here is a break down of how the tables work.

Table 1 Name: "category"
Fields for Table 1:  "cat" (the id number), "category" ( the actual name of the category)

Table 2 Name: "subcategory"
Fields for Table 2: "cat" (corresponds with the cat id from table 1 to pull the correct data), "subc" (the basic id of the subcategory), "subcat" the actual name of the subcategory.

so the way i see it, have a normal drop down populated by a php query. then on change, populate subcategory drop down where cat = cat and display sub category.

View Replies !
Populating The Drop Down And Pressing The Submit Button
1. The first is I have two drop down menus. The first is "year" and the second is "mfr". When a user selects a year from the drop down it then populates the second drop down, mfr, from the MySQL database. Theat is working fine. But the problem I am having is the "submit" button (which I have labeled as "browse"). When I click it. Nothing happens, no action tacks place. I have looked over the code and I can't figure it out. (See Code Box 1 Below).

2. Right now the "mfr" drop down is populated by the MySQL database and reads with a list like "Acr", "Alp", etc. These are abreviations. I need to set up an array to have them instead read the entire mfr name. Example: Instead of "Acr" it needs to be "Acura". Instead of "Alp" it needs to be "Alpine". I need these full names to appear in the drop down. I know I need to do something like this (See Code Box 2 Below) but I can't get my finger on it. Code:

View Replies !
Populating Drop Down List With Selected Vaue
I have a drop down box and the "selected" value needs to be selected by a dynamic value that gets entered into the database, this is currently how im doing it: PHP Code:

<?php
                if($modify_row[21] == "0") {
                  print "<option value=" "></option>";
                  print "<option value="1">Active</option>";
                  print "<option value="0" selected>In-Active</option>";
                } elseif ($modify_row[21] == "1") {
                  print "<option value=" "></option>";
                  print "<option value="1" selected>Active</option>";

Its fairly straight forward, basically the option that is automatically selected needs to be the one coming from the database $modify_row[21].

View Replies !
Populating City,state,country Drop Down Menu
In the registration form I have city, state, country fields. I was
wondering if there was a database available on the net which has the
list of states in each of the countries. That way when a user selects
a country I could automatically populate the state drop down menu ...

View Replies !
Drop Down Menu Select And Populating Data Fields
I have a PHP/MySQL Content Management System set up for the job I work at. It's basically a shift program that lets users pick up shifts, post shifts, etc.

The data fields are tied to the shift ID which is selected from a dynamically populated drop down box. However, I cannot get the data fields to be updated when I select a new value and I cannot get the form to accept the new selected Shift ID. I have tried using JavaScript but cannot quite get it to work. Code:

View Replies !
MySql Menu Populating
My goal is to use a Drop Down Menu that is populated by
the database. The user is then able to select a name from
the Menu that pulls all of the information for a particular
person from the database. Finally, a table is populated
with the information of the selected person.

View Replies !
Populating Array With Mysql Results
I'm returning a result set of one field in a table, and want to populate an array with the results. I can't for the life of me figure out a simple way to do this without using mysql_fetch_array() to cycle through the results, append that to a var, then explode that into a var and pass that. PHP Code:

View Replies !
Populating DHTML Menu From MySQL
I have a client that would like to have drop down menus added to a nav
bar that is generated from MySQL. Is it possible to have a dynamically
driven DHTML menu from MySQL?

View Replies !
Populating Arrays From MySQL Query
I have the following code: http://pastebin.com/746601

The field 'material' in 'is_material' contains multiple values for each
record in 'is_details'. Because of this I have used
'is_material_lookup' as a reference lookup table containing the
'style_code' and 'material_code' which refer to their full details in
the respective tables.

Currently I have got the script outputting all the details and one
material then in the next block of data, repeating the details with a
different material. What I would like to achieve is having 1 block of
data with a list of all materials in that, instead of the repeat, but
sadly I can't know exactly how to do it.

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 !
Populating A List/menu From MySQL
is there a way to populate a list, or a menu form using php, and MySQL? Basically i have a list, and i am planing to import 2 variables, id, and name, bouth id and name are variables loaded from MySQL (yes there are multiple id's, and name's) Name would be the label displayed, and the value would be id. Thats what i need. After that i will make a submit button, witch will post the selected id to a different file. How can i achive this? Does anyone hae any samples maybe?

View Replies !
Populating An Excel .csv File Rather As Well As MySQL
I am very new to this and have what may be a ridiculous question. Is there a way to have info populate both the MySQL table and an Excel .csv sheet? I know that I can go into PhpMyadmin and dump the data but this seems to be a bit cumbersome.

View Replies !
Populating Checkboxes From A MySQL Database
what im doing is populating a php variable, and trying to use the result to add either checked or nothing to the value of the checkbox. Any ideas? Code:

View Replies !
Populating A Table With Data From MYSQL
I have a mysql table with the column names like as "id" and "value" and "bizunit". I also have an HTML table that have unique DIV IDs that correspond with the mysql table.

$query = "SELECT value FROM paceReport2 WHERE bizunit = 10"

How do I write a loop statement that will populate each of the cells in the HTML table?

View Replies !
Populating Page Content From Mysql Db.
First off my db table is orginized in this way:

ImgKey (auto increments)
ImgType (pertaining to the buttons in the gallery)
ImgName (name of image)

When you click a button from the initial gallery page, my plan is to pass a query string to the next page with the appropriate ImgType. On the next page I need to grab all the records in the table with that ImgType. (you can see the next page by clicking the first button) Code:

View Replies !
Passing 'var' Via GET And Then Populating Page (mysql)
I have a table with a column of numbers (random):

0000000001
0000000026
0000000059
0000000034

And I would like to link them to go to 1 specific template page. Then once on that page, the number that was clicked gets "posted" to the MySQL Query and the information for the page populated dynamically rather than having to have 4 different pages for each number (that's the way I'm doing it now). Code:

View Replies !
Populating An Html Form With Mysql Data.
What I have is a basic html form I have made consisting of header fields and fileds that will be populated from a mysql database. The brackets are the actual db fields and denote where I want the data to populate. Here is a small example of the form. Code:

View Replies !
PHP-MySQL Drop-Down Box
I'm using PHP to dynamically make a drop down box of users in a table. The first row is displayed with all the users. However, on the second row non of the users are listed in the drop down box. It only works on the first.

View Replies !
2 Drop Down List Using MYSQL
I have a model table with the following fields: MODEL_ID, MAKE_ID, NAME.
And a make table with the following fields:
MAKE_ID, NAME.

The first drop down list (make) to select a make of a car i.e. Chevrolet, Ford. When a make is selected, then all the model for that paticular make appear in the second drop down list.

View Replies !
Two Different Drop Downs From MySQL
I have a admin area for a website, and on some part the admin can
select options from two different drop down boxes. Now i thought that
it would be better to use one Query for both dropdowns. How can i get
them together?
I now have something similair twice:

<select name="series_id" class="dropdownbox" id="series_id">
<option value="0">- select -</option>

<?php
$db = mysql_connect("localhost", "name", "pass");
mysql_select_db("db_name");
$result = mysql_query("SELECT * FROM series ORDER BY name");

if ($data = mysql_fetch_array($result)){
do {
$current_id = $data['series_id'];
if($current_id == $id){$selected = "selected";};
echo "<option value="".$data['series_id'].""
".$selected.">".ucfirst($data['name'])."</option>
";
} while ($data = mysql_fetch_array($result));
} else {
echo "";
};
mysql_close($db);?>
</select>

I hope it's clear what i mean. I do not make connection twice, but the
rest is similair except for the tablename of course.

View Replies !
PHP And MYSQL Drop Down List
I need a script to create a drop down list which has vehicle makes. The vehicle make list should feed a vehicle model list so when I select a make all the models for the make appear in the model list. I have a make table which has MAKE_ID, make NAME and a model table which has MODEL_ID, MAKE_ID and model NAME.

I tried using a script using javascript array but wherever I have a query that pulls the NAME from the database there's always a carriage return after the NAME which messes up the javascript array. I'd rather do it all with PHP if possible. If not please give me one that works and I don't have to spend hours troubleshooting.

View Replies !
Drop-down Form In PHP/MySQL
Is there an efficient way to have two drop-downs on one page, with the selection list in the second dependent on the selection in the first?  For example, suppose my SQL data is:

CATEGORY          PRODUCT
------------          -----------
fruit                   apple
fruit                   orange
fruit                   banana
vegetable           celery
vegetable           carrot
vegetable           onion

And I want a drop-down with two choices: fruit and vegetable.  Immediately beneath that drop-down, I want another drop-down that displays choices apple, orange, banana if "fruit" is selected above, but celery, carrot, onion if vegetable is selected. Code:

View Replies !
Drop For Cronjobs With Mysql
I have a few cronjobs that run through my database. some hourly while others are every half hour. each has its own set of objectives to complete. when they run they take about 1-2 mins to complete. They all basicly read a row and based on what is read it then updates that row. This happens roughly 65,000+ times every half hour.

My question is since this takes so long to complete and the site becomes slow as a dog. Should I look at another language to run the updates on mysql?


View Replies !
Generating Drop Down Boxes From Mysql
i'm using php with mysql. i need to be able to extract items out of my database and put them into a drop down box so that the data is dynamic.

In this example, i need to get all of the names from the name.office field into a drop down box to be used in further scripts/processess.

<html>
<head>
</head>
<body>

<?

$db = mysql_pconnect ("localhost", "XXXX", "XXXXX");

if (!$db)

{
echo "error: could not connect to database. please try again later";
exit;
}

mysql_select_db("XXXXXXX");
$query = "select name from office";
$result = mysql_query($query);
$num_results = mysql_num_rows($result);

$row = mysql_fetch_array($result);

?>

</body>
</html>what goes here??? i have tried many things and not been able to get it to work.

View Replies !
Drag And Drop Insertion In MySql
I'm developing a site in PHP/MySql that requires Ajax for this feature
: The user read an article and if ever he likes it he can drag it and
drop it into his "basket". Then when he'll consult its account he'll
found that article.

View Replies !
Mysql Fetch With Drop Down Menu
Im trying to do somekind of dropdown menu taking information from the database but im not quite sure how this could be done with my knowledge.

alright so lets say i have a table named: projects SELECT name FROM project. and it will put all the data found in a html drop down menu?

View Replies !
Drop Down Menus And Mysql Insertion
I'm looking to create drop down boxes for a user to select the date and then have it insert what they select for month, day, year, hour, minutes and insert it into mysql. It needs to be organized in a timestamp like so: 2007-02-28 21:06:40

I've created the drop down boxes and it works pretty well: Code:

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

View Replies !
Drop-down Displaying MySQL Data
I've got this dropdown trying to call the data in...basically, I only want it to show if it is an upcoming event. Past events are hidden away in the archives.

I can get it to work if I remove the if ($row['date'] etc, but not with it in. Can anyone spot any errors with my code? Code:

View Replies !
MYSQL/PHP Dynamic Drop Downs
I have a dropdown menu that is being populated by my database. Basicly I'm each record has a category that it's associated with. When my dropdown is populated it displays a category for every record. Code:

View Replies !
Drop Down List Box Using Data From MySQL
I've been trying to create a drop down list box using data from MySQL table. Mysql table is "ihs" and the field to be listed is "Bloom_Name", can someone tell me what's wrong with the code below and if possible tell me how to fix it.

<?PHP
mysql_connect("localhost", "xxx_xx", "xxxx") or die(mysql_error());
mysql_select_db("xxxx_xxx") or die(mysql_error());
$query="SELECT Bloom_Name FROM ihs";
$result = mysql_query ($query);
echo "<select name=ihs value=''>Bloom_Name</option>";
while($nt=mysql_fetch_array($result)){//Array or records stored in $nt
echo "<option value=$nt[id]>$nt[name]</option>";
/* Option values are added by looping through the array */
}
echo "</select>";// Closing of list box
?>

View Replies !
Trying To Connect A Drop Box To A Mysql Query
i have this problem: i want to create a new table into an existing database. i have no problems in creating the table in a fixed database, but i want to create it into an existing database which you choose from a dropdown box.

the box seems to work correctly but it doesn't
i am missing something: how can i connect the highlighted item in the dropdown box to the query: mysql_select_db($nomecategoria,$db); so that the new group gets created inside the highlighted database?

(sorry for italian language variables, but $nomecategoria should be the database in which i go adding the new table.)

excuse me for my english, i hope you have understood my problem.. i have to do this script for a university exam ....

View Replies !
Populate Drop Down From Mysql With Php Part II
I have this working sort of, but I still can't figure out why it is skipping the "uniqid" field. Does it not work if the field is an auto_incrementing INT value or something?

Also, where do I add the "form action" elements to this code to allow the user to actually submit after selecting? ....

View Replies !
Form / Drop Down Menu / MySql
I need to have a drop down list inside of a form which retrieves the data for the drop down list from a MySql Database. The data is in a table that will constantly be growing so obviously the items in the drop down list will grow as well. So the table is called "Songs" and the field is s_title. When the drop down list retreives the data I need it to place the songs in alphabetical order as well.

View Replies !
MYSQL Query To Drop Down List
i want to put the results from a query into a drop down list: my code so far: PHP Code:

View Replies !

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