SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2005
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Dependent Select List Boxes

    Hi,
    I am trying to display the contents of list box 2 depending on what is selected in list box 1.

    I have title names in list box 1, and depending on which title was selected, I want to display that title's available formats in list box 2.

    Code below:
    $title_listing .= " <td>\n";

    // First Select box
    $title_listing .= " <select name=\"titlebox\" size=\"10\">\n";

    // Query to get contents of List Box 1 (Titles)
    $sql = "SELECT pretty_name FROM titles";
    $result = mysql_query($sql);

    // Fill Query results in List box 1
    while ($row = mysql_fetch_array($result))
    {
    $title_listing .= " <option value=\"$row[pretty_name]\" SELECTED>$row[pretty_name]</option>\n";
    $title_listing .= " </select>\n";
    $title_listing .= " </td>\n";
    $title_listing .= " <td>\n";

    //Query to get contents of List Box 2 (Formats)
    $sql = "SELECT format_name FROM titles t, title_item_formats tif, title_items ti WHERE t.title_id = ti.title_id AND ti.format = tif.format_id AND t.pretty_name = '" . $row[pretty_name] . "'";
    $result = mysql_query($sql);
    $title_listing .= " <select name=\"formatbox\" size=\"5\">\n";

    // Fill Formats box depending on which title was selected
    while (list($format_name) = mysql_fetch_row($result))
    {
    $title_listing .= " <option value=\"$format_name\"> $format_name </option> \n";
    }
    }
    $title_listing .= " </select>\n";
    $title_listing .= " </td>\n";

    Many thanks for all the help!
    Last edited by cyclops80; Feb 10, 2005 at 20:59. Reason: Need some help from the PHP Gurus!

  2. #2
    $this->toCD-R(LP); vinyl-junkie's Avatar
    Join Date
    Dec 2003
    Location
    Federal Way, Washington (USA)
    Posts
    1,524
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Are you getting an error? Not getting the type of display you want? Something else? We need some details on the type of help you need.
    Music Around The World - Collecting tips, trade
    and want lists, album reviews, & more
    Showcase your music collection on the Web

  3. #3
    Non-Member St.'s Avatar
    Join Date
    Nov 2004
    Location
    Cloud #9
    Posts
    119
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh godness me.... 8/

  4. #4
    SitePoint Enthusiast
    Join Date
    Feb 2005
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Vinyl,
    No errors, but I am not getting the display I want. I am not able to capture the selected value from List Box 1.

    For instance,
    if I select Dodgeball in box 1, then box 2 should display DVD- FULL FRAME, DVD- Widescreen

    if I select XYZ in box 2, then box 2 should display only VHS depending on what format exist for that title.

    My sql queries are right, since I tested them in phpmyadmin.

    Thanks for your help

  5. #5
    SitePoint Enthusiast
    Join Date
    Feb 2005
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Where are all the PHP gurus? I am sure this is not that hard, I just need to find why the selected value from Select 1 is not feeding into Select 2.

    Can someone help this newbie out

  6. #6
    $this->toCD-R(LP); vinyl-junkie's Avatar
    Join Date
    Dec 2003
    Location
    Federal Way, Washington (USA)
    Posts
    1,524
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, I'd hardly call myself a PHP guru, but I'll try and help if I can.

    Take a look at this thread. It seems to be a problem very similar to yours.

    Hope this helps.
    Music Around The World - Collecting tips, trade
    and want lists, album reviews, & more
    Showcase your music collection on the Web

  7. #7
    SitePoint Enthusiast
    Join Date
    Feb 2005
    Posts
    55
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've done something similar at work. Have you considered using XMLHttp Request DOM? Check it out

    http://developer.apple.com/internet/...mlhttpreq.html
    -: Arnold Nicolas :-
    www.filgoods.com

  8. #8
    SitePoint Guru ujjwal's Avatar
    Join Date
    Oct 2004
    Location
    kolkata
    Posts
    821
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    use iframe
    -::Ujjwal::-
    Visit My Site


Bookmarks

Posting Permissions

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