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




How To Display .txt Info Into Drop Down List


list out all the items from a file (data.txt) into drop down box for user to select.

Eg. inside (data.txt) has
Apple
Orange
Strawberry
etc...

How do I create a drop down list that can call out everything from data.txt (until end of file)??




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Trying To Select Names From A Drop Down List And Display Them
So, I already have the code written where I have a drop down menu with names in it. I want to be able to select multiple names from the drop down list and have them display in a table below the drop down menu. First off, I can't get one name to display, not to mention multiples. :p How may I accomplish this?

CODE:

Submit The Drop Down Menu Info To Db?
What I have is a status(drop down menu) you should be able to select from drop down and it will update the status field in db. Code:

List Info In The Databases
im trying to list every username in my database i know that you have to take out the where un the mysql query any way here what i got Code:

Drop Down List
I want to read a directory for available files and then get the filenames and put them in a drop down list. Whatever the user will select will be the value of the variable $selected. I already found the code to read directories: Code:

Php And Drop Down List
I am coding an email form on a site. A user enters their name and contact email and then selects from a drop down list to which particular email the message should be sent: User1, User2, User3. Then the user types out a message and hits submit. My problem is that I am unsure as to how to grab the selection in the drop down list and pull the selection and place it like this: "$selection@domain.com". Here is the php code:

Drop Down Box To A List Box
i have this drop down box that displays the relevant info from the table that its loading. But the drop down box isn't quite so wise to use if there hundreds of rows. So what i wanted to do was change it to a list box instead ... would any one know how to do that? Code:

A Dynamic Drop Down List
I need to create a dynamic drop down list. By this i mean that the webpage html form = select style will recieve all the values as based on a query to a mysql database. I have no problems quering the data base with PHP, But i need to make some kind of for loop that will add a new value to the selct form for each result from the database. my thought process go like this.

1. call data base to guery. (no problem)

2. make variable variables that will be created according to the number of results (these variables must be created according to results of query, not a problem i think)

3. make a form like this

<form action = ***** method = post>
<select name = ******>
<option value = "This is a query result"> This is a query result> //This is the part i need to using a for loop and variable variables
</select></form>

so my problem is part 3, cause is this all done in PHP, or if i had all these variables, can i do this in HTML? Can i make a for loop in PHP that would break into HTML during these parts?

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.

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.

Very Simple Drop-down List...
Hi! I'm having a problem with a very simple drop-down list since the
page comes out with no elements in the drop-down but giving no errors.
This is the code:

<form name="year_search_form" method="post" action="results.php">
<select name="select_year" id="select_year">
<?
$query="SELECT * FROM table ORDER BY year";
$result = mysql_query($query) or die ("Error in query: $query. "
..mysql_error());

while ($line = mysql_fetch_array($result)) {
print ("<OPTION value=".$line['year']."></OPTION>"); }
?>
</select>
</form>

Drop Down List From An Array
I want the array to contain a valid year of birth for anyone between the ages of 16 and 80. I'm pretty sure this code is correct.(though it might be a bit sloppy to all you pros) Code:

Drop Down List With Months
I am trying to create a drop down list that has December 2006 as the first option and then goes up month and years till the current month and year (September 2007).

Putting List Into Drop Down
I am working on a directory of businesses which has 8 main categories and each category has several sub-categories. Example: Dining is a Category with Pizza, Fast Food, Chinese, etc. I have the sub-categories brought up in just a list on the left side of the page and when the user clicks on a sub-category it takes them from client_list.php to client_filter.php only showing businesses in that sub-category of the main category. 

So only pizza places listed under dining.  However, I want to change the list to a (form) select box and then have the user click on the sub-category they want and then it takes them to the client_filter.php page to list only those bussinesses in that sub-categorie.  So after that long explanation how do I change my code to do that. Here is my current code:

Insert From An Drop-down List
i have a table in wich i've inserted city's name.then i have an registration form in wich  i want to display an dropdown list with the cities from the table, and if one city is selected to be automaticly added in the second table. how can i do that?

Custom Drop Down List
I am trying to get categories from the database and show them in a drop down list showing root category then their sub category underneath. Code:

Folder List Drop-Down
I am developing a PHP/MySQL project and as part of my initial setup and configuration scripts, the users can select a skin for the application, and a variable value ($skin) is updated to set the current skin, this works ok on it's own, but currently the user must manually type the skin name in a free-text box.

Ideally this needs to be a drop-down option box, and I would like this to be populated by listing the sub-folders within the '/skins' folder, so that it's always up to date. The folder structure looks like this:

/skins
/skins/skin1
/skins/skin2
/skins/skin3

How can I use PHP to generate a list of the current sub-directories in 'skins' and populate the drop-down list?

How Do You Pass A Value From A Drop Down List?
I am completely new to this. I don't understand how to receive a value from a drop down list <select> menu. I have read many tutorials and none of them explain the process of receiving the sent data.

Drop Down List Of Months
I am trying to create a drop down list with 12 months as the contents. I need to be able to determine what the latest month is and then put the 11 months before into it (in the correct order). For example, it is September 2007 obviously at the moment, so that will need to be the last and latest month in the list. The other 11 will be in reverse order going back to August 2006.

Using SESSION Info To List Recent Visitors?
I would like to add a recent visitor feature to my web page.

Am wondering about the best way to do this, and am curious if anyone has any tips.

Is there a feature with SESSIONS to see who is currently connected? Or do I just need to timestamp everyone and query that information?

edit...

And I just noticed that little check mark at the bottem left of the post window that says someone is offline or online.

How the heck is that being done?

Opening A Page To Display The Right Info
I'm making a website where registered users can upload a photo as well as information. The main page will display all of the users' photos. When user1 clicks on, say, user5's photo i want a page to open up and user5's information. How do i do this?

Every user has a username stored in the database along with their information and the url to their photo. Code:

What Is The Best Way To Display Specific Info From A Table?
I am hosting a youth sport site and I want to display schedules by select teams.

I thought that I would want a drop down menu to select one of our 35 divisions, then a secondary search by team of that previously selected division menu.

My schedule is in a table with the fields:
* division
* date
* time
* home_team
* h_score
* visiting_team
* v_score
* field

I see problems, since secondary drop down menu would have to search two different fields.  Any suggestions and hint to where I would even start?

Chained Drop Down List Working Example
Could some PHP guru please help me? I looking for a good working
example of chained dropdown list.

2 Drop Down List Where Need Query Database
there is drop down list box linked to the database where it displays the state of a country and once the user clicks on the particular state, there purpose to be radio button displaying the locations available of that state, the location displayed in radio buttons are from the database. currently the source code i'm using is (which uses a submit button to query the database but i does not want the submit button it purpose to work using Code:

Dynamic Drop-down List In Array
Q. How do I create a dynamically-generated drop-down list for use in
an array.

I'm using PHP with a MySQL database (through phpMyAdmin)

My database table is called com_courses, and I want to pull the
distinct 'title' fields and have them appear as a drop down menu for
the user to select in a form.

Here is my array, with (at the moment) manually-entered 'titles'
(which I now need to be dynamically generated from my database field:
'com_courses.title'

array (
"coursetitle",
"Course Title:",
$EXTRA_SELECTLIST,

array ("Report Writing", "Recruitment & Selection", "Presentation
Skills", "Essential Telephone Skills", "Time Managememt", "Customer
Care", "Other"),
0
),

I am not an experienced programmer, but can play around with php to
customize programs. I've read up on arrays (I bought a "Programming
with PHP and MySQL" book, but it just stops short of this problem). I
can't figure this one out.

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:

Automatically Drop Down A List Of Phrases
I would like to know why when I go to a site like altavista.com and start to type in a phrase to search on does it automatically drop down a list of phrases that I have previously searched on, and how do I get rid of these from showing when I go to search.

I removed all of my cookies that were stored in my temporary internet folder. Is there somewhere else I should be looking. I am using IE 5.0 on a windows 98 machine.

How Do You Insert A Value From Drop Down List To SQL Table?
I am a bit new to PHP and SQL so this may seem like a dumb question.

I have already created a drop down list as part of a form which is
automatically populated with values taken from a separate database. When a
user goes onto this page and either leaves the default value or selects a
value from the drop down list and presses the submit button, I would like
that selected value to be stored into a database which I have already
created in SQL.

Just to let you know that I can do the above using a text field but just
don't know how to do it with drop down list.

If your going to explain any coding then it may help if I give you the names
of certain items that are involved.

Database is called "Company"
Field within database is called "Name"

Load Runner, Drop Down List
Can anyone send me the script for supplying the values in drop down
list of the web page?
I have couple of drop down list controls in my web page. I need to
supply multiple values for each dropdown list in my script. How can i
do that? can you send me the script for this?

PLEASE HELP - Drop Down List Related Question
I am creating a dynamic dropdown
list using a code snippet(Section A) as below:
Section A:
$sql_query=mysql_query("SELECT DISTINCT semester, year from
schoolproject_pics ORDER BY year
DESC");
echo "<select name="semester" onchange="GoTo()">";
echo "<option value="$semester">-Semester Year-</option>";
while($data = mysql_fetch_array($sql_query)){
if($data[semester]==@$semester && $data[year]==@$year){
echo "<option value
selected="$data[semester]">$data[semester]:$data[year]</option><BR>";
}
echo "<option
value="$data[semester]">$data[semester]:$data[year]</option>"; }
echo "</select>";
mysql_free_result($sql_query);

The 'GoTo()' Javascript re-draws the same page with the chosen values
of 'semester' and 'year' so that
the values can be recovered by $_HTTP_GET_VARS, stored in two hidden
variables and then used in
another query to create another dynamic drop-down list, as in code
snippet (Section B).

$semesternow=$HTTP_GET_VARS['semester'];
$yearnow=$HTTP_GET_VARS['year'];
if((isset($semesternow) and strlen($semesternow) 0) and
(isset($yearnow) and strlen($yearnow) 0)){
print("<input type="hidden" ID="semesterchosen"
value="$semesternow">");
print("<input type="hidden" ID="yearchosen"
value="$yearnow">");
$sql_query2=mysql_query("SELECT DISTINCT school from
schoolproject_pics
WHERE semester='$semesternow' AND
year='$yearnow'");
echo "<select name="school" onchange="GoMore()">";
echo "<option value="$school">-- School --</option>";
while(list($school) = mysql_fetch_array($sql_query2)){
echo "<option value="$school">$school</option>";
}
echo "</select>";
mysql_free_result($sql_query2);

Now the question:
When the page is re-drawn, how can the values of semester and year
previously chosen, be displayed in the first drop down list. I tried to
do it using the following, but it does not do anything:

f($data[semester]==@$semester && $data[year]==@$year){
echo "<option value
selected="$data[semester]">$data[semester]:$data[year]</option><BR>";
}

Multiple Drop Down List Problem And MySQL
I am trying to populate around 30 drop down lists via a single query to a mySQL database. The problem is how to make sure that each drop down list only display it's relevant data. for example the table is as follows:

Error Correction On Drop Down List & Sessions
Hi I'm doing a site at the mo and I have to do error correction on a form. I have most of it done except one or two bits. What I'm having trouble with is drop down lists. What happens is someone fills in the form, it's not done properly so it gets redirected back to the form. Everything works right except the drop down list. The sessions carries over alright but I can't get the drop down list session to work. It marks the session as selected but it's not displayed the first option is displayed. So if you picked Germany and America was first on the list. After being submited America would be displayed but Germany would be checked.

Here is what I got

Correction page

$_SESSION["country"] = $_POST["country"];
if($_SESSION["country"] == &#390;'){
header("Location: /acc1.php");
}

Form page

echo ' <td><select name="country" id="country" style="width: 150px;">'
if (!isset($_SESSION["courtry"])){
echo '<option value="0" checked="checked"></option>'
}

$rslt = mysql_query($dscntry);
if($rslt){
while ($rws = mysql_fetch_array($rslt)) {
if (!isset($_SESSION["country"])){
echo '<option value="'.$rws["countryid"].'">'.$rws["countries"].'</option>'
}
elseif(isset($_SESSION["country"])){
if($_SESSION["country"] == $rws["countryid"]){
echo '<option value="'.$rws["countryid"].'" checked="checked">'.$rws["countries"].'</option>'
// else{
// echo '<option value="'.$rws["countryid"].'">'.$rws["countries"].'</option>'
// }
}
}
}
}
echo '</select>'

Dynamic Drop-down List With Array - Question
Can anyone out there give me a pointer regarding creating a
dynamically-generated drop-down list connected to an array?

And is that question as clear as chocolate spread?

Here's what I've got. I'm using PHP and MySQL database. I'm customizing
some calendar software, and I want the user to fill in a form by
selecting a title from a drop-down list, generated by my MySQL
database. However, the program I'm customizing uses arrays, which is
where I'm stumped.

What do I need to add to this code to make the array of titles(eg
"report writing" etc) come from my database, rather than the
manually-entered values that you can see here.

The field I want to pull from is called com_courses.title

array (
"coursetitle",
"Course Title:",
$EXTRA_SELECTLIST,

array ("Report Writing", "Recruitment & Selection", "Presentation
Skills", "Essential Telephone Skills", "Time Managememt", "Customer
Care", "Other"),
0
),

I hope it's not cheeky to ask this,
BTW I bought a book on Programming with PHP and MySQL, but it doesn't
answer this question,

How To Response Immediately When I Select The Drop-box List
Do you have any idea when I try to select a drop box list, the data
will show up in the following textbox immediately?

eg.

Name:
---------------
drop-box list | <- when i select one of them
---------------

Age:
---------------
Textfield 1 | <- pop up immediately
---------------

Address:
---------------
Textfield 2 |
---------------

Saving/Loading Data In Drop-down List
I have a drop-down list with set values.  When there is a corresponding value in my database when the page loads I want the drop-down list to pick the appropriate value from the list.  Instead it always defaults to the first value.  Can anyone give me an example of how to do this?

Also, one time after adding a variable to a classes file this symbol:  started showing up on all of my pages. Has anyone seen this before? I can't find any information on the web about it.

Populate A Drop Down List In A Form On The Basis Of A First Selection
I have developed a form to register a property in a db. The form needs the selection of a country and then based on that selection the selection of regions from the selected country. I have a program which allows selection of a country and then a region but it uses java script which I would like to avoid. I also just wanted one submit button if possible. Code:

Select From Drop List To Fill Table Column With Text -- HOW ?
I want viewers to compare state laws on a single subject.

Imagine a three-column table with a drop-down box on the top. A viewer
selects a state from the list, and that state's text fills the column below.
The viewer can select states from the drop down lists above the other two
columns as well. If the viewer selects only one, only one column fills. If
the viewer selects two states, two columns fill. Etc.

I could, if appropriate, have a separate htm page with the text for each
state -- california.htm for example. When the viewer selects California from
the drop down list, the column below would "fill" with California.htm.

Or, I could conceivably use a text or mysql database with two fields for
each record: state_name and law_text -- but it would probably be easier to
use separate htm files, since there will only be about 20 states involved,
and the "database" would never have a large number of records.

The table width would be 100% and each cell would be @33%

My site is designed with FP 2002 and runs on Apache/FreeBSD. I have just had
Apache-ASP installed but I have not yet configured or used the module.

Displaying Data From Mysql Database In A Drop Down List On Form.
I'm trying to do is display data from two different mysql tables from the same database in a drop down list on a html form. I have a fixtures table with the player1(userid), player2(userid), gameid, game, score1 and 2, what I want is to use the userid to get the players first name and surname from the members table (as it is a unique id), I need to do this bit before displaying it in the drop down. I think i need 2 querys to do this but when I have tried it it just echo's a blank value or the userid not the forname and surname that I want. I'm using the fetch_array function but just can't see where I'm going wrong, Code:

Using Php To Display Unordered List
I have a (MySQL-)database table with columns like:

id ¦ study ¦ parent_id

How do I display (using php) a tree that looks like this:


<ul>
<li>category A</li>
<ul>
<li>sub category A-1</li>
<li>sub category A-2</li>
<li>sub category A-3</li>
</ul>
<li>category B</li>
<ul>
<li>sub category B-1</li>
<li>sub category B-2</li>
</ul>
<li>category C</li>
<ul>
<li>sub category C-1</li>
<li>sub category C-2</li>
</ul>
</ul>

How To Automatically Display From A List Box?
I am working on a PHP/HTML form which supports End User queries.

I need the user to select a combination of Airline and corresponding
place of Origin. i,e
Delta - Madison, Dallas, Atlanta
KLM - Amsterdam, Houston, Detroit
Brit - New York, London, Seattle

I have a list of Airlines in a list box. The moment the user selects an
Airline(Delta) from the List box, the list box below it needs to have
(Dallas, Atlanta, Madison) as its options.

How is this done? How do I use a listbox selection as a trigger an
automatically start the next activity?

Display A List Of Files In A Folder
How do you display a list of files in a folder and then delete one by clicking on it?

List Of Sybmols Like To Display > On Html Page &gt And Which Are Others
i am making an application.

the user can give description and that description is stored in
database and then the description is shown on html page.

suppose the user has written "<b>hello</b>" in description then in the
database the following will be stored "<b>hello</b>" but when i display
it on database the hello in bold letter will be displayed.

i know the soultion that i have to replace the occurrences of < with
&lt and occurrences of > with &gt but i don't know that which are other
symbols which needs some repair like above so please give me a list of
html symbols and their equivalent symbol.

Dynamically Populate Drop-down List And Dynamically Include Html File
We have a drop down list on a PHP page, with several product names, and
when people click one item, we will refresh the same page with the
product name as parameter, and in turn we want to include a HTML file
into the content area of the same page.

I know it is recommended to put everything into database, but we want
the web site to be very "portable", so the drop-downlist and the
content should both in text files.

Let's say the drop-down list will be poplulated from the product.txt
file, and there will be a file for each corresponding item in the
drop-down list. From the user point of view, if he wants to add a new
product, he will just need to open the product.txt file, and add a new
line with the product name, "Laptop", then add a new text file named
"laptop" in the same folder which contains the HTML fragment to be
included in the content area.

What is the easiest way to do this?

Putting Info Into A DB / Passing Info Between Pages
I have run into an issue...I have posted previously, but my scenario has changed.

Here is the situation...

If a user clicks on a link ('abc123' for example) I want to insert into my database some predefined information about 'abc123' - I have assigned a value that is echoed in future pages for 'abc123'.

So, what I need is some mechanism to, when a user clicks 'abc123', have a pre-defined username and password be entered into the database. I need this so future pages can utilize the session values.

Drop Down Lists Changing Depending On Other Drop Downs
I want to have a drop down system like this one.  But without the radio buttons.

I want to have 3 drop downs but have no idea how to go about it.  I assume I will need to activate some sort of Javascript on the onChange event of the option drop downs.

List Contents Of A Folder, Make List Of Links
Does anyone know how I can write a script that:

- reads in all the files in a particular directory
- displays the file names in a html list and makes a link of them:
<ul>
<li><a href="filelocation1">filename 1</li>
<li><a href="filelocation2">filename 1</li>
<li><a href="filelocation3">filename 1</li>
</ul>

etc.?

So basically it creates a list of links with the contents in that directory,
so you can download them from there.

Get List Of Messages From One Table, Message List Indicator From
I have two tables. One has a list of messages left by users using fields named mbxno for the mailbox and msgno for the message number. I have another table that has mailbox settings for each user that contains a field named "messagelist" to indicate if they want to be included on the message list or not.

What I'm trying to create is a list of the most-recent messages with a lookup on the users table to indicate whether a message in the list should be included in the message list based on the user's mailbox settings.

SELECT messages.msgno, messages.mbxno, users.messagelist FROM messages, users WHERE (users.messagelist = &#391;') ORDER BY msgno DESC LIMIT 100

What I'm getting, though is a list that looks like this:

mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 1114 msgno: 0412141623 msglist: 1

I think what's happening is that I'm using the wrong type of join and more rows are being created than necessary.

If I add "DISTINCT" to the query, I get a list of the most-recent messages as I expect, but the "messsagelist" value is sometimes wrong (again, probably because the data is getting jumbled). For example, the messagelist value for the second row (2214) should be 0, not 1.

mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 2214 msgno: 0412141622 msglist: 1
mbxno: 2189 msgno: 0412141408 msglist: 1
mbxno: 0000 msgno: 0412141213 msglist: 1
mbxno: 0003 msgno: 0412141213 msglist: 1
mbxno: 2265 msgno: 0412132029 msglist: 1
mbxno: 0000 msgno: 0412131950 msglist: 1

How should I be doing this? If nothing else, what kind of join will work with a long list compared to a value from a short list?

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.

Mailing List Manager, Send To List
I'm looking for a mailing list script (php) that has a function to let
users to reach out to all recipient on the list by simple send the
email to a specific maillist- address.

Mailman has this functionn but as a just got a webserver account I
can't use mailman nor install it.

I Need Info...
I want to write a very simple PHP script that just picks random images from a directory, you know what i mean. So I'd like to know where I could find information about this in the PHP manual maybe?


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