...

View Full Version : help on listing using drop down boxes



madolia
12-20-2006, 07:59 AM
I need big help. Here goes:

I need to display names from my mysql database onto a drop down box or a list box. currently Using php for that. The problem is that there are 3000 entries and its a lot.

then, I need text boxes where the user can search the names of the people required BASED ON typing their names, character by character and as you go along, filters out the required names.

The next problem is that instead of only one, the user can choose the number of entries they want.

i am using javascript and php. please someone help me.

madolia
12-21-2006, 02:27 AM
Hi Ancora,

thanks for the reply. What you showed me is fine. However, instead of the button show choices, is there any way you can drag and drop selection somewhere or accumulate the total number of inputs? so lets say i want to choose Bailey, Cannon, Atwood, to store them in teh database, how do i do that?

madolia
12-21-2006, 02:49 AM
I don't know if this helps you guys out there but this is my script.

Steps
1) Asks user to enter number of entries required ($col)
2) Grab data from database and store into $options using function (generate_box)
3) Use 'for loop' to display number of required dropdown boxes based on ($col).
4)Place $options in dropdown box

This first part, I use PHP to get data from database and store into $options
-------------------------------------------------------------------------

#GRAB THE PROGRAM INFO ONE BY ONE AND STORE INTO $OPTIONS
function generate_box()
{
$sql = "SELECT * FROM programid order by PRG_ID ASC";
$results = mysql_query($sql);
$entries = mysql_num_rows($results);

while ($info = mysql_fetch_array($results))
{
$data = $info["PRG_ID"];
$desc = $info["DESCRIPTION"];
$options .= "<option value=$data>
$data - $desc
</option>";
}
return $options;

}$options = generate_box();
--------------------------------------------------------------------------

Next comes the 'for loop' and to display in the drop down box.
--------------------------------------------------------------------------

#GENERATE NUMBER OF ROWS OF PROGRAM KEY IN
for($i=0;$i<$cols;$i++)
{
echo"
<tr>
<td></td>
<td>
<select name=id[$i] style=width=400>
<option value=''>-------</option>
$options;
</td>
</tr>";
}
--------------------------------------------------------------------------

This is wat I have in my code. I like ANCORA's suggestion. Can anyone help me out there? Cos my way of doing it is not feasible for a user to search 3000 over records



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum