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.





Dropdown List - Trying To Get Default Populated From Db.


Nooby question but when I try and get this to work (it should identify which
rows in the database have GK, MID, DEF, FWD against them and then put
SELECTED into the option value to give a default of what the entry is
currently) it just adds SELECTED to all the results as if $row["Position"]
is returning true against all four conditions? What am I doing wrong? CODE:..




View Complete Forum Thread with Replies

Related Forum Messages:
Dropdown List Selected By Default?
Does any one know how to have an item in the dropdown list selected by default?

$city_field = HTML_QuickForm::createElement('autocomplete', 'city', 'City', $cities);

$cities is an array of city names and I would like, say 'Los Angeles' selected by default.

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 !
Duplicates In A Dropdown Menu Populated From My Database
I've been searching to figure out how not to have duplicates in a dropdown menu populated from my database. This is what I have, but how do I change it to get rid of duplicates.

<?php
$result = mysql_query("SELECT City FROM residential order by City");
echo "<select MULTIPLE NAME="City_code">";
while($row = mysql_fetch_array($result)){

echo "<option name="City" value="$row[City]">$row[City]</option>";

}
?>
</select>

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 !
Dynamically Populated List Menu
I have a DB with a field called county in a table called info. I want to populate the list menu below with the counties in the field county.

Would there be a way to get around the fact that there will be many entries with the same county and we want only 1 instance in the list menu? Code:

View Replies !
Dynamic List Populated By MySQL Table
I am building my first php page and I've ran into problems trying to create a dynamic drop down list for an INSERT page. My page is based on this example from mysql.com.

I want to populate the list from a table in MySQL, but when I test the page the list only contains the first record. If anyone can help me out, or recommend an easy way to create dynamic menus/lists, I will be very grateful.

This code appears above the FORM ACTION:

$NearMajorCity = mysql_query("SELECT NearMajorCity_ID, NearMajorCity FROM NearMajorCity");

This code is within the FORM:

<SELECT NAME="NearMajorCity" SIZE=1>
<OPTION SELECTED VALUE="">Select One
<OPTION VALUE="">---------
<?php
while ($NearMajorCity = mysql_fetch_array($NearMajorCity)) {
$NearMajorCity_ID = $NearMajorCity["NearMajorCity_ID"];
$NearMajorCity = $NearMajorCity["NearMajorCity"];
echo("<OPTION VALUE='$NearMajorCity_ID'>$NearMajorCity
");
}
?>
</SELECT>

I want to be able to view the names of the Major Cities in the list, but I want the NearMajorCity_ID inserted into the table.

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 !
Setting Default For A Dropdown
I use this bit of code to create a dropdown menu for the number of days in a month: PHP Code:

<?

for ($day=0; $day<=31; $day++) {
    echo "<option value="$day">$day</option>
";
}
?>

I want to set the default value to "14" though. How can I do that?

View Replies !
Dynamically Selecting Default From Dropdown
I have a dropdown menu with 17 options that I want to use to edit a mysql entry. Before I edit it though I want to load the value of that particular mysql column as the pre-selected value in the drop down. Whats the best way to accomplish this. I figured I could write 17 if than statements but thats seems a bit tidious especially if I have more then 17 options. I'd preffer to have the code written out for the options and just add in the selected statement if possible. PHP Code:

<select name="country" id="country">
                <option value="1">CAN</option>
                <option value="2">USA</option>
                <option value="3">RUS</option>
                <option value="4">CZE</option>
</select>

If the result for country = 1 I'd like to add the selected code to the option.

View Replies !
Populating A List Box Or A Dropdown List Using Php And Odbc
I need to populate a list box and/or a dropdown list on a form. I have all
the bits and pieces together, all bar the code which takes the result of a
query and creates a list box.

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 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 !
By Default My Drop Down List Starts With 31.
Why is it by default my drop down list starts with 31. How should i allow the loop to begin with 1?

Code:
$day = array (1=>"01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31");
$select = "<select name="day">";
foreach ($day as $key => $val)
{
$select .= " <option val="".$key.""";
if ($key)
{
$select .= " selected>".$val."";
}
else
{
$select .= ">".$val."";
}
}
$select .= "</select>";
echo $select;

View Replies !
Default Menu/List Option
I'm trying to create a form with three menus, each with the same values, and I have no problems there. Each menu has it's initial value set at "None" and then the rest of the values are pulled from my MySQL db. Everything works great if the user selects three values that came from the database or selects something from the first menu but not the other two and then submits. The problem is when the user doesn't select anything from the first menu.

The next page reads the form value as "" instead of "None" but only for the first menu. The other three menus work fine. I know this isn't really php related, but this is usually such a helpful forum that I thought I'd post here before I start to search for some helpful html forum. Answers would be greatly appreciated, but so would corrections for my terminology (which I think I am confused about) or a good link to a place where I should be asking this question.

View Replies !
Populating Dropdown List
I am wanting to know how to populate the <SELECT> dropdown menu with all existing values from the DB and also have the value associated with that id selected. This is an updating area of my admin. Any ideas? Here's the code so far. At the moment it only retrieves the value assigned to that id. PHP Code:

View Replies !
Smarter Way Of Doing Dropdown List?
I've got a dropdown list that is acting as a filter on a table, so the user can select a value and the page is reloaded only showing the matching values from the database.

Now when the page reloads the dropdown was set to 'all' as it was first in the list, even if I'd selected a different value, this was confusing for users, so I added an initial <option> field which pulled the correct value from $_GET (code below) - however this is a little odd as it means the value appears twice!

Does anyone have a genius solution to this?  I've seen a <select selected="yes"> sort of thing around, but I don't know how I can tell the php to add this value dynamically? 

<select size='1' name='occupation'>
<option>".$_GET['occupation']."</option>
<option value='All'>All</option>
<option value='Student'>Students</a></option>
<option value='Professional'>Professional</option>
<option value='Hobbyist'>Hobbyists</option>
</select>

View 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 !
List The The Entries Of The Dropdown Box
How can I list the the entries of the dropdown box (which are all populated) according to the time they are populated.

View Replies !
Check The Dropdown List
i have a drop down list in my php code. i need to check the drop down list is set or not. for that what is the code. i heard that there is no php code for that. javascript is needed. my code is here. PHP Code:

<?php
$database="sms";                    /* DB name       */
$host="localhost";
$user="root";                        /* Set DB Username */
$pass="";                            /* Set DB password*/
mysql_pconnect($host,$user,$pass);  /* DB connect....*/

mysql_connect ($host,$user,$pass);

mysql_select_db($database) or die( "Unable to select database"); /*DB Select*/

function orgresult()
.......

View Replies !
Add Variables To Dropdown List
I have a list of variables:

$variable[0]
$variable[1]
$variable[2]

The amount of variables changes so i've used $total = count($variable) to find the amount there are.

How would i tell php to create a dropdown menu with the amount of options=$total and then fill the options with $variable[0] etc.

I know i can use a loop to increase the value of say $i by one each time to that i can use $variable[$i] each time, i'm just stuck with adding the whole thing to a dropdown menu with the right number of option...

View Replies !
Autopopulate Dropdown List From Database
An events-registration page with a form containing a dropdown list for upcoming events, the events will be pulled from a table which is updated by...?

what i've gathered so far is that this can be done with PHP. I am a little unclear on the concept of how this is done. How does the updated information get input into the table?

1) can this be done (updating database) through a web interface by the client, or is it something i would have to do locally and then upload. If done by the client, can he delete/edit existing information--assuming he is not familiar with code.

2) what other things aside from html(good), sql(so-so), and php(newb) will i have to know?

i've seen a lot of good tutorials here and will have access to the necessary software. I just want to know if there is anything else i should know before i dive in head first without testing the PHP water, which i assume is frigid.

View Replies !
Dropdown List Of Files In Folder
I am preparing a form that includes a drop-down list consisting of the names of files in a certain folder on the server.

I only need to trap the file name (jpg), not the path and I'm not trying to upload the files or anything - simply allow the user to select one of a number of different image files (they're actually location maps).

View Replies !
Cascade Dropdown Or Conditional List
I would like to create a conditional cascade form.  based on the selection, it can display or not display an input form for the user to enter an string of text. then at the bottom of the page (or when a user submit) connect all the sections including the input field all together (it's like a story maker?)

View Replies !
Microsoft Access Dropdown List
l am building a new site using PHP which has a lot of pages pulling from an Access Database. I would like to have a dropdown list that pulls exhibitions from the database and then when the user selects one it shows the rest of the details from DB just below the dropdown list, hope that makes sense. Code:

View Replies !
Trying To Create Dropdown Menu From List
I am trying to create a dynamic dropdown select menu from a directory containing other directories and files. This is to select a certain page from the list so I can edit it. I only want the files in the menu. Here's what I have so far but it doesn't populate the dropdown. Code:

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

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

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 !
Setting Default Value On Drop Down List - Displays Wrong Value
I have the following code segment, which is meant to show the drop down list with default option selected 'Any type'. It takes the other values from an array called $arr_proptype. Code:

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

View Replies !
Auto Fill Dropdown List Error
Im using the code below to autofill a dropdown list from my MYSQL DB.
The only problem is it is leaving out the first entry (alphabetically) for each $vehicle_make ? Does anyone know why this may be hapenning? Code:

View Replies !
Stuck On Dropdown Menu List, Could Use Some Guidence
I have a form with some drop down list/menus. I do a check for ommissions and if found display a message to re-try. What I need is a way to show which options where chosen when the user submitted the form the first time.

If someone could show me how to do the first one, I'm sure it's the same process for the second one. Here's the code:

View Replies !
Auto Fill Date Dropdown List
How would I modify this code to display the years in the dropdown list like so:

current year
2006
2005
back 50 years

<select name="year" id="year">
<?PHP

for($i=date("Y");
$i<=date("Y")+2;
$i++)
if($year == $i)
echo "<option value='$i' selected>$i</option>";
else
echo "<option value='$i'>$i</option>";
?>
</select>

View Replies !
Creates A Dropdown List Of Information Belonging To That User.
I have a page that uses php to look up specific fields in a specific table of a specific database based on the username. Using this, it creates a dropdown list of information belonging to that user. The fields in question each have 13 pieces of data. Based on what they click in the dropdown box, I need that specific data to pass onto hidden fields on the page. Code:

View Replies !
Easy Comma-delimited List To Dropdown Box Converter
I was working on a simple converter when I realized that by not setting the id param of the option tag, it wasn't going to send the value of the dropdown box to my php script. I had this to start with: Code:

View Replies !
Pick From A Drop Down List That Automatically Gives Options In A Second Dropdown Box
does anyone know how to create a form that allows the user to firstly pick from a drop down list that automatically gives options in a second dropdown box. eg.

'category1'
is selected from dropdown box 1,
this then populates dropdown box 2 with the options
'category1.a' or 'category1.b'

or if
'category2'
is selected from dropdown box 1
then dropdown box 2 gives the options of
'category2.a' or 'category1.b'

i f any one knows how I should code this please help, if not point me in the direction of a tutorial that can.

View Replies !
Dropdown List Which Selects A Post A Title (to Edit)
I want to have a dropdown list which selects a post a title (to edit), then when you click submit I want to use POST to submit the data for that post (post title, username, subject, content) so that the edit pages form fields will already be filled with the posts data.

View Replies !
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 !
Database Stores Default Number Everytime, But I Havent Set A Default Number??
Im having some problems with my database. Everytime i store a number which is longer than 10 numbers the script or database puts this number into the database: 2147483647. Its does this everytime no mather how i write the numbers and nomather how long the number is, it just needs to be over 10.

I have set any default value in the database and to be sure i havent i tried deleting the table, but same thing happends again???

View Replies !
Populated Dropbox
I am trying to populate drop down box from one table in database, and get some info from another table to show selected Code:

View Replies !
Populated Filed
I have a field in a form that I want to populate with suggested content that the user could either use, edit or delete and insert their own details. The user will have logged on via a username and password.

Once the user finishs editing the content I want it to appear as the edited version the next time he/she opens that page. Can someone give me a thumbnail of the process needed to insert the text that I want to show when the user opens the page?

View Replies !
Drop Down Populated By Database
I currently have a php
file that pulls a query from the field "category" from my database.
this file is called category.php. I am trying to populate a drop down
box in another page (called add_subpage.php) from the results of the
category page. the code below is on the add_subpage.php file: (It was
my best guess and does not work)

<select name="category">
<option value="CAT"<?php include 'category.php' ?>></option</select>

Can anyone tell me how to make this drop down populate from the
category php file?

View Replies !
$ POST Variable Not Being Populated
My host is running php 5.1.4 yet the $_POST global doesn't seem to be being populated with anything from form's being submitted. Here is my code for the page at <removed>

<?php

echo"inputter is $inputter and post var is ".$_POST["inputter"];

echo"<br/><br/>The following variable are in the $_POST array<br/>";
print_r($_POST);
echo"<br/><br/>The following variable are in the $_GET array<br/>";
print_r($_GET);
echo "<br/><br/>The following variables are in the $HTTP_POST_VARS array<br/>";
print_r($HTTP_POST_VARS);
echo "<br/><br/>The following variables are in the $_REQUEST array<br/>";
print_r($_REQUEST);
?>

<form action="test.php" method ="post">
<input type ="text" name="inputter">
<input type="submit">
</form>
?>

View Replies !
Trying To Make Populated Drop Down Box Query
My host is Godaddy, sql 4.1 - trying to create a populated drop down list that when submitted, displays the info row by row. I can populate the list, and when I post it takes me to the next page. The php on the next page makes the table header but there is no data underneath.

There is data in the table cause I can display it all on another php page I have. Code:

View Replies !
Pre Populated Php Form From Database Problem
so I want to populate a form from my database, edit it and then submit it back to a different table.

I am using a while loop to display every row entry in the database as a form field.

now when I try to add the submit button it adds one after each form field (row from the db)
(I would also like to add a form field at the top that doesnt COME from the database but will be passed to it from the form)

I figure that its just a problem with placement but I learn to program from google and Ive been googling all day and getting no where!

View Replies !
Connecting Two Database Populated Select Menus
I am able to grab the data from the database to populate the menus individually using.
PHP Code:

View Replies !
Any Reason Why $_FILES['userfile']['error'] Wouldn't Be Populated?
I am in the middle of writing an image upload script and am limiting
the size of uploads via upload_max_filesize. This all seems to be
working well, and if I try and upload a bigger file then I get an
UPLOAD_ERR_INI_SIZE sat in $_FILES['userfile']['error']. All hunkey
dorey.

However, in my testing there are one or two large files that cause
problems. PHP appears to abort the upload early as it should, but when
my script runs, $_FILES isn't populated at all?!

I have tried to narrow down the difference in these file but I can't
seem to find anything definate. All the ones that fail are AVI or WMV
files if that gives any clue, but even if I rename them to MPG (others
of which work ok), and check the MIME type being sent up has also
changed to mpg, then they still fail as before. I have sent bigger and
smaller files all ok, so it's not size. I can't see anything in the
filename itself that would cause problems.

View Replies !
Get A Drop Down Box That Is Populated By The Results Of A Mysql Querie
i've got a drop down box that is populated by the results of a mysql querie but for some reason it only shows the first word. so if i have the results;

test 1
test 2
test 3

it will just display test, Code:

View Replies !
Using Natsort On A MySQL Populated Drop Down Menu
I am trying to use the natsort function on a dropdown menu which is populated by the mysql database. Code:

View Replies !
Adding Columns To A Populated Table - Bad Practice?
I got a scenario where i need to design a table for userProfiles. Currently the profile stores userID's (foreign key - there's a user table which stores the userIDs), and against each userID i need to store the number of times the user has accessed each of the available services offered. Code:

View Replies !
User Needs To Press The Submit Button Before The Iframe Is Populated.
I have a search box that is included on all pages. When entering your search it takes you to the search results page which list results from my MySQL database. The thing is I take the string that has been input ($keywords) and auto enter it into my google search box of which the result of this search is displayed in an iFrame under the search results from MySQL.

The only problem is that the user needs to press the submit button before the iframe is populated. There for is there a way that this can be done automatically as I would like hide the google box and have the user submit only on the original search.

View Replies !
Open Popup Window When Page Is Loaded If A Field Is Populated
Would it be possible to open a popup window on loading the instruction page but only when the critical information section of the page contains text?

The popup window could either contain the contents of the critical information section or just a visual warning that such information exists on the main page.

I have a pretty good knowledge of VBA but sadly my knowledge of php and javascript is very limited.

View Replies !

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