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.





Auto Populate Dropdown


How would I automate this script below so that I dont have to modify it each year (example; when the year reaches 2008)

<?
// Make the years array.
$years = range (2007, 1930);
// Make the years pull-down menu.
foreach ($years as $value) {
echo "<option value="$value">$value</option>
";
}
echo '</select>'
?>




View Complete Forum Thread with Replies

Related Forum Messages:
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 !
Populate Dropdown W/o Submit
Ive got some arrays; one array is most of the U.S states. the other arrays are names of clinics my company has within the selected state. I want to be able to select a state from a drop down and have another drop down next to it that will populate itself automatically.... without having to press a submit button.

View Replies !
Populate Textfield From Dropdown
I know I have done this before but I havent programmed in a while and I can't seem to figure it out. I have a DB with ID, item, unit, and cost where item is the name of the item, unit is the unit of measure (i.e. - per hour or per day etc..) and cost is the price per unit.

Now, I have a form that auto generates and item dropdown list from the DB. Then there 2 text fields - one to enter quantity and one to enter price. What I want to happen is when an item is selected, the price per item goes in the price text field automatically and then next to the quantity field it changes to 'per hour' etc..

View Replies !
Populate Dropdown Not Working
I have an intranet site that I need to convert as the database backend has changed from MySQL to Postgresql. The following code should populate a dropdown box, I have changed the MySQL functions to Postgres functions but its not happening. db_connect() is connection function from include file. Code:

View Replies !
Auto Populate Fields
I have a html form which contains two select menus and a number of textfields. When the user chooses from selectmenu1 then selectmenu2 is populated with data pulled from database. Code:

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 !
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 !
Auto Select Dropdown Lists From Db Values
I want a simple HTML drop-down list like this: Code:

<select name="select_1">
<option name="option_1" value="option_1" selected="true">
<option name="option_2" value="option_2" selected="false">
</select>

to be able to automatically select a value according to a value in a table in the database. For example, if a MySQL table has a field named "field_1", and one of the rows has a value of "option_1" in that field, I want the list (using PHP of course) to automatically select the option name "option_1".

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 !
Populate/Re-Populate Array "onClick" With Checkboxes
I have a list of items - could be 1 could be 100 on 1 page. Each item has a checkbox. Looks something like:

<input type="checkbox" name="expsel[]" value="<?=$somevar['id']?>" onClick"document.myform.submit

Basically what I'm trying to do is this:

#1 - when an item is checked - submit the form and store the value of the checkbox in a session array. $_SESSION['userinfo']['expsel'] which will be an array of its own.

#2 - when an item is unchecked - submit the form and reprocess the array to remove the item that was unchecked.

The reason for the session array is that at some point they will have selected all that they want and will press a button or link to export to CSV. So I'll process the session array and get them the info needed. That part is no biggie.

I'm having problems understanding how what to write to catch the checked/unchecked boxes.

View Replies !
Using Php To Populate A <ul>
I'm am pulling data from a mysql db and want to use the data to populate a <ul. Here are relavent parts of my code :

$wohdate = mysql_result($wohRS,$wohndx,woh_date);
$woh_display .="<li>".$wohdate."</li>" ;

$TemplateText = Replace($TemplateText,"@$wohdisplayndx@",$woh_display);


print($TemplateText) ;

So, I have 8 woh_dates that I retrieve (verified with an echo).
My page only displays the first of the 8.
ie :
2000-01-01
2001-01-01
2002-01-01
are retrieved, but only 2000-01-01 is displayed on the page.
Something wrong with appending as I am doing in
$woh_display .="<li>".$wohdate."</li>" ;

View Replies !
Populate One Menu From Another
I thought this would be simple and there would be advice / tutorials
everywhere for this, but now that I'm working on it, I can't find any
reference except for ASP or Javascript code. PHP/MySQL - 3 form select
menus: Project, Categories, Subcategories. When a Project is selected, the
Categories list is populated based on Project selected, then Subcategories
list is populated based on Category selected. I see this all over the Net,
but through 10 books, there isn't anything specific. I think I get lost
with some of PHP structure since I've been using DW - I end up editing most
of it in order to follow it, but DW works pretty good for getting initial
testing done. I just can't seem to find further guidance on this. So far I
have:

View Replies !
Selection Of The First One To Populate The Second Box.
I have 2 drop down boxes on my site. I want the selection of the
first one to populate the second box.

View Replies !
Populate Form
I have a database of project number, client info, address, phone, ect. And I have a form to add data, and one to edit data... On the edit data form, I want to set it up so that when the project number is highlighted via a pull down list of active project numbers, that project number fill auto fill the form with the clients info from the database.

Then, the user can edit this info...and submit the mofifications. Is this done with php, javascript, or ajax? Which is best? I'm pretty sure this could be done with php, but how? Can I get an example of code? a good starting point.

View Replies !
Populate A Listmenu
I am trying to populate a listmenu from a database with php if I run the code below it works fine. Except if I want to run it inside the table where I need it then I get the Listmenu but its empty ?. Code:

View Replies !
Populate A List Box From A Url
I have two list boxs on a page Team A and Team B I would like to fill the list boxs with teams from a division.

So if I have a link to the form like myform.php?div_id=3 I want to populate the list boxs from the url so I only see teams for the division selected in the link Code:

View Replies !
Table Won't Populate
I am able to connect to the database with no trouble. The next thing I do is assing variable names to the POST variables. This is also working correctly.

The next step is to populate a customers table and that is working with no trouble. The next step is to perform some calculations from data in another table. The calculations are working as well.

The problem is when I try to populate the ORDERMAIN table. The fields won't populate and I can't seem to figure out why. I've checked to make sure that all my table fields match the columns in the query - that is fine.

I made sure that the columns in the query match the order of which the fields are in the table - that is fine. The only thing happening is no data is being placed into the table.

I'm hoping a second, third, or even fourth pair of eyes may see something that I am missing. Code:

View Replies !
Populate Combobox In PHP
is it possible to populate the comboxbox in PHP without reloading the entire page? we have three combo boxes the values of second combobox is populated from database according to selected item in first combobox but I don't need to regresh entire page.

View Replies !
Populate Drop Down
I have a text file with the following fields.

item
file

Here's how it looks now.

TEST ITEM | test.pdf
ANOTHER EBOOK | another.zip


I need to create a dropdown list populated by the data in the item field. The posted variable name is $item_name and the value should be the names of the items in the item field.

View Replies !
Populate Database
does anybody know how to populate a database from a text file? With using script and NO loada database in file command..

View Replies !
Field In DB Won't Populate
I'm running a small test query and I'm trying to populate a table. The table has three fields: item_code, price, qty. When I run my script, price and qty are populated and item_code is not. Code:

View Replies !
Populate A Foreign Key In One DB
I have a table called attendees that has attendeeID as a primary key. Then I have a table called relationships that has groupID as its primary key and attendeeID as a foreign key (from the attendees table). Both tables get populated from fields in a single HTML form and both of the primary keys are auto-incremented.

What I need to do is populate both tables at once when the submit button is clicked and insert whatever auto-incremented value attendeeID was given in the attendees table into the attendeeID field in relationships.

View Replies !
Populate Combobox
php/mysql applications and would like to know if it's possible to populate a combobox from a database query. I can't find anything like that in the forum. I have a list of places that a user entered into the database and want to present that list to him at a later stage through a select box.

View Replies !
Populate PDF Fields With PHP Variables
I have a HTML Form that needs to take the variables and place them into a PDF with the corresponding fields that I have created with acrobat. I guess there is a two-part question coming up.

1. What is the process of taking my HTML variables and placing them into the PDF fields in the PDF file I created?

2. Does PDFLib that I hear so much about accomplish this task?


View Replies !
Populate In To The Form Fields
i worked on some programs that gets the datas from the user and insert them in to the database.now i want to retrieve the data from the database
and i want them to populate in to the form fields.

View Replies !
Dynamically Populate PDF Form
I found a free script/class online a few months ago which enabled me to populate pre-built PDF forms with data using PHP; without using any toolkits etc (it worked perfectly). It was simply a PHP script. I lost the script when my PC died recently DOH!

Does anybody know where I can find such a script again? I have searched google all night, but all I find is commercial products (not cheap!) or toolkits for generating PDFs', not filling pre-built PDF forms. Here is what I am trying to do:

I have built a site for a client which incorporates e-learning. Students take lessons and if at the end of the course their grades are sufficient, they download a PDF certificate. The certificate is in PDF format with Form Fields for the required data. The certificate needs to display the students name, grade and course name. I need a PHP script which can import server-side data into a PDF form which the user can then print or save (flat). The last (and lost) script did this so I know it is possible.

View Replies !
Create & Populate Table?
I am trying to do two things with one form:

1. Create a table in a MySQL database
2. Populate it at the same time

So far I have been able to create it, but the population isn't going so well. Here is the basic code I am using. PHP Code:

View Replies !
Populate An Array With The Dates
Im having trouble tweaking this snippet of code below, basically what the code does is it calculates the current position in a week, goes to previous monday and prints twelve weeks(of mondays) into a dropdown box.e.g: for the start of this week, (Mon 7th July), it will print the following:

call_date >= &#3907; July 2003' AND call_date < &#3914; July 2003'

Which is all ok, but what Id like to also do is populate an array with the dates between (and including) the dates above e.g:

07 July 2003
08 July 2003
09 July 2003
10 July 2003
11 July 2003
12 July 2003
13 July 2003
14 July 2003

Hope you understand what Im trying to achieve. PHP Code:

View Replies !
Populate Oracle Table
Does anyone have a reference on how to do an insert with php into an oracle table.

View Replies !
Populate A Table That Is Already Created
I'm trying to run some script to populate a table that is already created. When I run the below code I am getting the completed message at the end, but my data is not going into my table....is there something incorrect with this code that is causing the issue? Code:

View Replies !
Insert Into Database - Populate
I am currently working on committing this to the database.  however my problem is that not all of these fields may be populated.  For example q3c may be left blank therefore only two records need committing to the db instead of three. Code:

View Replies !
Dynamically Populate A Drop Down Box
I have a website with products for sale and along side each item I have displayed the number of each of these items that are left in stock.  What I want to do is to have a dropdown box so that the user can choose the qty of itmes to order but they should not be able to order more than what is in stock.

For example if there are 5 items left then the drop down box must be initialised at 0 and show the numbers 1,2,3,4,5.  When a purchase is made then the drop down must be adjusted to match what is left in the database. Code:

View Replies !
Populate Form From Database
I need to somehow change the SQL query so that when I select the client name from the selectbox 'clientdd' it fills the form out with their data. Code:

View Replies !
Populate A Database Via File?
How do I populate a database via txt or csv file, usign PHP? I want the person to choose the file to upload it in a website... and it will populate some table in the database choosen.

View Replies !
How Do You Populate A List Dynamically?
how do you populate a list dynamically? for example I have the following in a table but I can't get them into the list after the query is performed.

<form action="">
<select name="cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="fiat">Fiat</option>
<option value="audi">Audi</option>
</select>

View Replies !
Populate Radio Boxes
I have a form with radio boxes. when I display the form I read the data from a database and put it in the appropriate input boxes but I have not figured out a way to populate the radio boxes (or dropdowns) for example if the database says the person is female I would like the radio box for female checked.

View Replies !
Populate HTML Form From DB
I would like to know the basics of populating a html form from fields in a db. I have data in a db that i would like to modify through a html form. How can i load the db data into the html form and then take the changes?

View Replies !
Populate Javascript Variables
is this possible to populate the gallery.buildpagination below with data from a mysql database? PHP Code:

<script type="text/javascript">
var gallery=new virtualpaginate("virtualpage4", 1)
gallery.buildpagination("galleryalt", ["Home", "Products", "Deals", "Services"])
</script>

View Replies !
Populate An Array With Images
I am trying to populate the following html with the contents of an image directory: Code:

View Replies !
Populate Form Input
i have a text area that you can enter text into from an "admin" section of the site. the text box updates a chunk of text on the site thats displayed from the database. the problem is that when you logout and then log back in to the admin section, the existing text of the box isnt in the box, its blank.

if you want to edit the other options on the page, when save the page without putting new text in the box, the box is made blank on the site. my question is, how do i get the current contents of the box from the database into the box when its in the admin section being edited?

View Replies !
Populate Result Query
I query database and it produces rows of results. I want to populate it so that the first 10 rows go to the 1st page, the next 10 rows to the 2nd page and so on. The last page will be at most 10 rows and it can be less than that. How do I do it? Or do anybody know if there is any sample code that I can refer to?

View Replies !
Code To Populate Listbox
I'm trying to create a php script that creates a listbox and populates the list with values from a table named Inventorytable. I only need the values from the ItemName field to be populated in the listbox. Here is what I have so far..

<?

$conn=mysql_connect("127.0.0.1", "odbc", "") ;
mysql_select_db("php012",$conn) or die ("error cannot connect");
$sql = "select itemname from inventorytable;";
$result = mysql_query($sql,$conn);
while ($array = mysql_fetch_array($result)) {
print $array[ItemName];}
<html>
<SELECT >
 <OPTION VALUE="01">Option 1
 <OPTION VALUE="02">Option 2
 <OPTION VALUE="03">Option 3
 </SELECT>
</html
?>

View Replies !
Populate Combo Box Based On The Value Of Another One!
I need to query two tables using two combo boxes. The tables are of this type : author/publications , brand/products ..etc..

Whenever I chose a value in the first ComboBox , the second one should be populated based on the value chosen in the first one.

The first combo box is populated, so I can tell that nothing is wrong for the first combo box code. however, when i try to change it's value nothing happens , "the scond one is not populated". 

I don't know what is the problem.. Maybe it is a mistake to pass javascript variable to php using IEwindow.location.href ?!. If it is a mistake ,then how can i pass javascript variable to php variable?? Code:

View Replies !
Populate Notes Database
Our website form (code below) when submitted, sends the information to a Notes database. Within Notes there is an agent (macro) that, when activated, sends an email form to a user with the same information from the website and Notes DB. The user is receiving the form but with all the fields blank with no data. Code:

View Replies !
Populate The HOSTNAME Drop Down Box
I have a PHP page that has a bunch of drop down boxes that ask for a start date and hour, an end date and hour and a hostname.

Well, everything thus far has been OK because I didn't really have to use any dynamic content, until now. I would like to populate the HOSTNAME drop down box to read from MySQL database. The problem is that the data is stored as such: Code:

View Replies !
Dynamically Populate Form
I am tasked with creating a script that takes data submitted in a form on my site, goes to an external site, and populates the fields. For example, if I am at www.mysite.com, I fill out a form with my data (name, address, etc). On form submission, user is redirected to www.someotherdudessite.com and the fields are populated with data from my form.

View Replies !
Populate Array Using Refresh
I have a small problem about arrays. I wanted to populate an array everytime I refresh a page. the problem is everytime i refresh a page the array itself gets overwritten so the array resets. I tried using session to retain the value of the array but it still doesnt work.

View Replies !
Populate Form From MySQL
I am kinda confused why the states select FORM will not populate from MySql. PHP Code:

<tr>
              <td class="label">State:</td>
              <td class="field">
                <select name="state">
                <?php if (isset($_POST['state'])) { ?>
                  <option selected value="<?php echo $_POST['state'] ?>"><?php echo $_POST['state'] ?>
                <?php } ?>
                <option value="">
                <?php
                  $result = mysql_query("SELECT abbrv, states FROM wsd_states ORDER BY states");
                  if ($result) {
                    if ($frow = mysql_fetch_row($result)).

View Replies !
How To Populate Option Values ?
Well my aim is to dynamically fill option value from a recordset.

//connection stuff

$result = mysql_query($myquery);

<select name="test" size =1 id="myselect">
<option value ="1">one</option>

<?php

// need some codes here to dynamically assign
// the option values from the recordset array $result
?>

View Replies !
Populate Picklist From Directory
I have been searching for a week and am unable to find and example to "Populate picklist from directory and return file name". I have a php script that reads a log file and plots a graph. Right now, the log name is hard coded. The logs are archived each day in the form of say ddmmyy.log and I would like to put a drop down list in the script that would allow my script to run off the "log" picked or default to the current "hard coded" name.

View Replies !
Using PHP And MySQL To Populate (select) Menus
I am a newbie to php *gasp* and I am trying to make a <select> drop down menu, but I want the menus populated by information from a field in my database. There are a bunch of entries in the field MUD, that are identical......I would like the menu NOT to repeat identical names. EX... Each name only once, even though it is in the database many times.

View Replies !
Retrieve Data From The Database And Populate
I know how to fill data in text boxes and submit to the database and retrieve from the database. But how do you retrieve data from the database and populate a drop down menu?

View Replies !

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