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.





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

View Replies !
Dynamic Dropdown Menu
with help from the PHP Gurus here, I have a dynamic menu script:

PHP Code:

<?php
$time = time() + 28800;
$time_plus2 = strtotime('+ 6 days');

echo '<select name="select">'
while ($time <= $time_plus2)
{
    echo '<option value=>' . date('l, F d', $time) . '</option>'
    $time = strtotime(date('Y-m-d', $time) . ' + 1 day');
}
echo '</select>'
?>

how do I now get the days of the week to link to different pages?

View Replies !
Dynamic Content Using Dropdown
I have the following dropdown menu which is populated by content or categories (with catID being the category ID) from the database. What I want to do though is when an item in the drop down list is selected, I want to show dynamic content under it. BTW, I must not emphasize on "dynamic" too much because it may seem like a DHTML thing going on here. For example, if a user selects a certain item/category in the list, I want content such as coupons in the DB which have the same catID as the category selected showing up.

The coupons are discreetly placed in the DB table "coupons" with the category ID being catID and...for eg:

catID --- couponname --- couponinfo --- expiredate

If you are going to include any kind of javascript, please write them as well. Here is the code I am starting off with:

===========================
<form name="myform">
<select name="selectID" size=10 > <? $resultcat = mysql_query("SELECT * FROM Category");

while ($myrow2 = mysql_fetch_array($resultcat)) {?><?printf("<option value=%s>%s</option>", $myrow2["catID"],$myrow2["name"]); } ?></select></form>

View Replies !
Three Dynamic Dropdown Boxes
Can any one help me in dynamic drop down creating? I have three dropdowns One for Country one for state and one for location. My plan is to select the country from dropdown according to this i have load the values in state drop down from MySql table. Depending on the state i have to select the location too.

View Replies !
Selecting Initial Value On A Dynamic Dropdown Box
I have a drop down box and am trying to figure out how to select the initial value from the results of a query on my page. Code:

View Replies !
How To Create A Dynamic Dropdown List
how to create a Dynamic drop down list using Mysql.

View Replies !
Dynamic Dropdown Menu Glitch
I wrote this code to dynamically generate an array from files on my server and put it into a drop down menu, but the code cannot be inserted on any page anywhere without it cancelling the loading of the rest of the page. Any ideas? Here is the code: PHP Code:

<? $the_array = Array();
$handle = opendir('walrus/strips/.');
while (false !== ($file = readdir($handle))) {
   if ($file != "." && $file != "..") {
$file = substr($file, 0, -4);
$the_array[] = $file;
   }
}
closedir($handle);
asort ($the_array);
reset ($the_array);.....


View Replies !
Dynamic Dropdown List Using Access
I am creating a dropdown list that is populated from an Access DB: Code:

View Replies !
Network Bar, Dynamic, Dropdown Menu
Basically I have a "network bar" that I place on the top of all my sites, which has a dropdown menu box to interlink all my other sites. Basically I would like to really modify this idea out more. Code:

View Replies !
Assign Dynamic Dropdown To Variable?
Is it possible to assign a dynamic dropdown script to a $variable? Code:

View Replies !
Dynamic Fill Form Fields Depending On Dropdown Box
This question has probably already been asked, but let me ask again

I have a mysql database to which I connect with my php scripts. The
database contains articles. Name, Unit_Price and Reference

Now my client needs to order 5 items, click a button and a table with 5
lines and 3 columns appears (until now easy)

In the first column is a drop down box with a <select > and <options> in
which I store all possible names.

I would like than whenever the client changes one of the boxes (in my
case there are 5) the Unite_Price column and Reference column in the
line he just choose get automatically updated

View Replies !
Creating Dynamic Page Based On Dropdown Selection?
I'm using Dreamweaver, but I believe this is a general PHP/MySQL question. I have a table, with 4 fields: id, year, car_make, car_model. The data looks like this:

1 1992 Honda Civic
2 1994 Ford Probe GT
3 1999 Audi S4
4 2002 Porsche 959

On my web page, I have a drop down list that's propogated automatically with the "car_model" field entries which are pulled from that table. So when I click the down arrow, I see Civic, Probe GT, S4 and 959. Code:

View Replies !
Data Entry Form With Dynamic Dropdown Boxes
I am working on a Form for user to register & enter their info such as name, email, address, tel etc. and I put in a couple of dropdown boxes namely country and city where user can select. I made them dynamic, i.e. the city dropdown is based on the selected value from country and the data retrieved from MySQL database.

The problem I have is the Javascript script involved a reload of the form and once I select a value from Country, the city dropdown populated with data OK but the data entered beforehand (Name, email, etc.) disappeared.

View Replies !
PHP Dynamic Drop Down Menus, Page Displays Diff Data Depending On Dropdown Selected.
I currently have two drop down menus the first one with countries and then the second one changes depending on which country is selected to display counties.

This works fine, now what I want to do is have it so when it county is selected it shows all the squash clubs that are in that county below the drop downs. Code:

View Replies !
Dynamic Variables To Dynamic Form
I have a form method="post" generated dynamically bu a "for".

<form action="" method="post">
<?php
$total = 10 //custom value
for($i=1; $i<=$total; $i++)
{
$subdata=explode("][",$data[$i]); 
echo "<div>$i:
<input type="text" name="opt[$i]" size="40" maxlength="40" value="$subdata[0]" />
<input type="text" name="img[$i]" size="25" maxlength="50" value="$subdata[1]" />
<input type="text" name="num[$i]" size="4" maxlength="4" value="$subdata[2]" />
</div>";
}
?>
<input type="submit" value="Submit" />
</form>

It's ok in php 4, but in PHP 5 doesn't work.
How to generate the variables to make the code php5 compilant? Code:

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

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