Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Jul 2006
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question help on listing using drop down boxes

    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.

  • #2
    New Coder
    Join Date
    Jul 2006
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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?

  • #3
    New Coder
    Join Date
    Jul 2006
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation

    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
    -------------------------------------------------------------------------
    PHP Code:
    #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.
    --------------------------------------------------------------------------
    PHP Code:
    #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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •