Jump to content

Recommended Posts

Hello,

 

 

 

I have a dropdown-box named "add_fd3" where user can select model. There are two type of models; "1F15203 FB F15M" and "1F15302 FB F15E". Now, differents are letter M and E. There is another dropdown-box named "add_fd5" (cables) where you can choose cable lenght, but only "E" models get to choose cable. All (where letter "M" is displayed) others must disable.

 

So to clarify, when you choose model "1F15203 FB F15M" another dropdown-bos is disabled from users. And when choosing 1F15302 FB F15E, you can choose cable.

 

Code:

 

<td class="ThRows style2">Model</td>
<?php
$cellvalue = "";
if ((!isset($_GET["add_fd3"])) && (!isset($_POST["add_fd3"]))) {
    $itemvalue = "";
} else {
    $itemvalue = qsrequest("add_fd3");
}

    $cellvalue = "<select name=\"§\" ><option value=\"\"" . qscheckselected("",$itemvalue,"selected") . ">-- Valitse --</option><option value=\"1F15203 FB F15M\"" . qscheckselected("1F15203 FB F15M",$itemvalue,"selected") . ">1F15203 FB F15M</option><option value=\"1F15213 FB F15ML\"" . qscheckselected("1F15213 FB F15ML",$itemvalue,"selected") . ">1F15213 FB F15ML</option><option value=\"1F15302 FB F15E\"" . qscheckselected("1F15302 FB F15E",$itemvalue,"selected") . ">1F15302 FB F15E</option><option value=\"1F15312 FB F15EL\"" . qscheckselected("1F15312 FB F15EL",$itemvalue,"selected") . ">1F15312 FB F15EL</option><option value=\"1A25203 FL F25M EFI\"" . qscheckselected("1A25203 FL F25M EFI",$itemvalue,"selected") . ">1A25203 FL F25M EFI</option><option value=\"1A25213 FL F25ML EFI\"" . qscheckselected("1A25213 FL F25ML EFI",$itemvalue,"selected") . ">1A25213 FL F25ML EFI</option><option value=\"1A25302 FL F25E EFI\"" . qscheckselected("1A25302 FL F25E EFI",$itemvalue,"selected") . ">1A25302 FL F25E EFI</option><option value=\"1A25312 FL F25EL EFI\"" . qscheckselected("1A25312 FL F25EL EFI",$itemvalue,"selected") . ">1A25312 FL F25EL EFI</option><option value=\"1A25413	FL F25 ELPT EFI\"" . qscheckselected("1A25413	FL F25 ELPT EFI",$itemvalue,"selected") . ">1A25413	FL F25 ELPT EFI</option><option value=\"1A3G203	FL F30 M GA EFI\"" . qscheckselected("1A3G203	FL F30 M GA EFI",$itemvalue,"selected") . ">1A3G203	FL F30 M GA EFI</option><option value=\"1A3G213 FL F30 ML GA EFI\"" . qscheckselected("1A3G213 FL F30 ML GA EFI",$itemvalue,"selected") . ">1A3G213	FL F30 ML GA EFI</option><option value=\"1A3G312 FL F30 EL GA EFI\"" . qscheckselected("1A3G312 FL F30 EL GA EFI",$itemvalue,"selected") . ">1A3G312	FL F30 EL GA EFI</option><option value=\"1A30413	FL F30 ELPT EFI\"" . qscheckselected("1A30413	FL F30 ELPT EFI",$itemvalue,"selected") . ">1A30413	FL F30 ELPT EFI</option></select>";
    if ($cellvalue == "") {
        $cellvalue = " ";
    }
    print "<td class=" . $css_class . " align=Default >" . $cellvalue . "</td>";
?>
</tr>
<tr>
<td class="ThRows style2">kpl</td>
<?php
$cellvalue = "";
if ((!isset($_GET["add_fd8"])) && (!isset($_POST["add_fd8"]))) {
    $itemvalue = "1";
} else {
    $itemvalue = qsrequest("add_fd8");
}

    $cellvalue = "<select name=\"add_fd8\" ><option value=\"1\"" . qscheckselected("1",$itemvalue,"selected") . ">1 kpl</option></select>";
    if ($cellvalue == "") {
        $cellvalue = " ";
    }
    print "<td class=" . $css_class . " align=Default >" . $cellvalue . "</td>";
?>
</tr>
<tr>
<td class="ThRows style2">Kaapeli</td>
<?php
$cellvalue = "";
if ((!isset($_GET["add_fd5"])) && (!isset($_POST["add_fd5"]))) {
    $itemvalue = "";
} else {
    $itemvalue = qsrequest("add_fd5");
}

    $cellvalue = "<select name=\"add_fd5\" ><option value=\"\"" . qscheckselected("",$itemvalue,"selected") . ">-- Valitse --</option><option value=\"877773A3 3 ft  0,92m\"" . qscheckselected("877773A3 3 ft  0,92m",$itemvalue,"selected") . ">877773A3 3 ft  0,92m</option><option value=\"877773A4 4 ft  1,2m\"" . qscheckselected("877773A4 4 ft  1,2m",$itemvalue,"selected") . ">877773A4 4 ft  1,2m</option><option value=\"877773A5 5 ft  1,5m\"" . qscheckselected("877773A5 5 ft  1,5m",$itemvalue,"selected") . ">877773A5 5 ft  1,5m</option><option value=\"877773A6 6 ft  1,8m \"" . qscheckselected("877773A6 6 ft  1,8m ",$itemvalue,"selected") . ">877773A6 6 ft  1,8m</option><option value=\"877773A7 7 ft  2,1m \"" . qscheckselected("877773A7 7 ft  2,1m ",$itemvalue,"selected") . ">877773A7 7 ft  2,1m</option><option value=\"877773A8 8 ft  2,4m \"" . qscheckselected("877773A8 8 ft  2,4m ",$itemvalue,"selected") . ">877773A8 8 ft  2,4m</option><option value=\"877773A9 9 ft  2,7m \"" . qscheckselected("877773A9 9 ft  2,7m ",$itemvalue,"selected") . ">877773A9 9 ft  2,7m</option><option value=\"877773A10 10 ft  3,0m\"" . qscheckselected("877773A10 10 ft  3,0m",$itemvalue,"selected") . ">877773A10 10 ft  3,0m</option><option value=\"877773A11 11 ft  3,4m \"" . qscheckselected("877773A11 11 ft  3,4m ",$itemvalue,"selected") . ">877773A11 11 ft  3,4m</option><option value=\"877773A12 12 ft  3,7m \"" . qscheckselected("877773A12 12 ft  3,7m ",$itemvalue,"selected") . ">877773A12 12 ft  3,7m</option><option value=\"877773A13 13 ft  4,0m \"" . qscheckselected("877773A13 13 ft  4,0m ",$itemvalue,"selected") . ">877773A13 13 ft  4,0m</option><option value=\"877773A14 14 ft  4,3m \"" . qscheckselected("877773A14 14 ft  4,3m ",$itemvalue,"selected") . ">877773A14 14 ft  4,3m</option><option value=\"877773A15 15 ft  4,6m \"" . qscheckselected("877773A15 15 ft  4,6m ",$itemvalue,"selected") . ">877773A15 15 ft  4,6m</option><option value=\"877773A16 16 ft  4,9m\"" . qscheckselected("877773A16 16 ft  4,9m",$itemvalue,"selected") . ">877773A16 16 ft  4,9m</option><option value=\"877773A17 17 ft  5,2m \"" . qscheckselected("877773A17 17 ft  5,2m ",$itemvalue,"selected") . ">877773A17 17 ft  5,2m</option><option value=\"877773A18 18 ft  5,5m \"" . qscheckselected("877773A18 18 ft  5,5m ",$itemvalue,"selected") . ">877773A18 18 ft  5,5m</option><option value=\"877773A19 19 ft  5,8m \"" . qscheckselected("877773A19 19 ft  5,8m ",$itemvalue,"selected") . ">877773A19 19 ft  5,8m</option><option value=\"877773A20 20 ft  6,1m \"" . qscheckselected("877773A20 20 ft  6,1m ",$itemvalue,"selected") . ">877773A20 20 ft  6,1m</option><option value=\"877773A21 21 ft  6,4m \"" . qscheckselected("877773A21 21 ft  6,4m ",$itemvalue,"selected") . ">877773A21 21 ft  6,4m</option><option value=\"877773A22 22 ft  6,7m \"" . qscheckselected("877773A22 22 ft  6,7m ",$itemvalue,"selected") . ">877773A22 22 ft  6,7m</option><option value=\"877773A23 23 ft  7,0m \"" . qscheckselected("877773A23 23 ft  7,0m ",$itemvalue,"selected") . ">877773A23 23 ft  7,0m</option><option value=\"877773A24 24 ft  7,3m \"" . qscheckselected("877773A24 24 ft  7,3m ",$itemvalue,"selected") . ">877773A24 24 ft  7,3m</option><option value=\"877773A25 25 ft  7,6m \"" . qscheckselected("877773A25 25 ft  7,6m ",$itemvalue,"selected") . ">877773A25 25 ft  7,6m</option><option value=\"877773A26 26 ft  7,9m \"" . qscheckselected("877773A26 26 ft  7,9m ",$itemvalue,"selected") . ">877773A26 26 ft  7,9m</option><option value=\"877773A27 27 ft  8,2m \"" . qscheckselected("877773A27 27 ft  8,2m ",$itemvalue,"selected") . ">877773A27 27 ft  8,2m</option><option value=\"877773A28 28 ft  8,5m \"" . qscheckselected("877773A28 28 ft  8,5m ",$itemvalue,"selected") . ">877773A28 28 ft  8,5m</option><option value=\"877773A29 29 ft  8,8m \"" . qscheckselected("877773A29 29 ft  8,8m ",$itemvalue,"selected") . ">877773A29 29 ft  8,8m</option><option value=\"877773A30 30 ft  9,2m \"" . qscheckselected("877773A30 30 ft  9,2m ",$itemvalue,"selected") . ">877773A30 30 ft  9,2m</option><option value=\"877773A32 32 ft  9,8m \"" . qscheckselected("877773A32 32 ft  9,8m ",$itemvalue,"selected") . ">877773A32 32 ft  9,8m</option><option value=\"877773A34 34 ft  10,4m\"" . qscheckselected("877773A34 34 ft  10,4m",$itemvalue,"selected") . ">877773A34 34 ft  10,4m</option><option value=\"877773A36 36 ft  11,0m \"" . qscheckselected("877773A36 36 ft  11,0m ",$itemvalue,"selected") . ">877773A36 36 ft  11,0m</option><option value=\"877773A38 38 ft  11,6m\"" . qscheckselected("877773A38 38 ft  11,6m",$itemvalue,"selected") . ">877773A38 38 ft  11,6m</option><option value=\"877773A40 40 ft  12,2m \"" . qscheckselected("877773A40 40 ft  12,2m ",$itemvalue,"selected") . ">877773A40 40 ft  12,2m</option><option value=\"877773A42 42 ft  12,8m \"" . qscheckselected("877773A42 42 ft  12,8m ",$itemvalue,"selected") . ">877773A42 42 ft  12,8m</option><option value=\"877773A44 44 ft  13,4m \"" . qscheckselected("877773A44 44 ft  13,4m ",$itemvalue,"selected") . ">877773A44 44 ft  13,4m</option><option value=\"877773A46 46 ft  14,0m \"" . qscheckselected("877773A46 46 ft  14,0m ",$itemvalue,"selected") . ">877773A46 46 ft  14,0m</option><option value=\"877773A48 48 ft  14,6m \"" . qscheckselected("877773A48 48 ft  14,6m ",$itemvalue,"selected") . ">877773A48 48 ft  14,6m</option><option value=\"877773A50 50 ft  15,2m \"" . qscheckselected("877773A50 50 ft  15,2m ",$itemvalue,"selected") . ">877773A50 50 ft  15,2m</option><option value=\"877773A52 52 ft  15,9m \"" . qscheckselected("877773A52 52 ft  15,9m ",$itemvalue,"selected") . ">877773A52 52 ft  15,9m</option><option value=\"877773A54 54 ft  16,5m \"" . qscheckselected("877773A54 54 ft  16,5m ",$itemvalue,"selected") . ">877773A54 54 ft  16,5m</option><option value=\"877773A56 56 ft  17,1m \"" . qscheckselected("877773A56 56 ft  17,1m ",$itemvalue,"selected") . ">877773A56 56 ft  17,1m</option><option value=\"877773A58 58 ft  17,7m\"" . qscheckselected("877773A58 58 ft  17,7m",$itemvalue,"selected") . ">877773A58 58 ft  17,7m</option><option value=\"877773A60 60 ft  18,3m \"" . qscheckselected("877773A60 60 ft  18,3m ",$itemvalue,"selected") . ">877773A60 60 ft  18,3m</option><option value=\"877773A62 62 ft  18,9m\"" . qscheckselected("877773A62 62 ft  18,9m",$itemvalue,"selected") . ">877773A62 62 ft  18,9m</option><option value=\"877773A64 64 ft  19,5m \"" . qscheckselected("877773A64 64 ft  19,5m ",$itemvalue,"selected") . ">877773A64 64 ft  19,5m</option><option value=\"877773A66 66 ft  20,1m \"" . qscheckselected("877773A66 66 ft  20,1m ",$itemvalue,"selected") . ">877773A66 66 ft  20,1m</option><option value=\"877773A68 68 ft  20,7m \"" . qscheckselected("877773A68 68 ft  20,7m ",$itemvalue,"selected") . ">877773A68 68 ft  20,7m</option><option value=\"877773A70 70 ft  21,3m \"" . qscheckselected("877773A70 70 ft  21,3m ",$itemvalue,"selected") . ">877773A70 70 ft  21,3m</option><option value=\"877773A75 75 ft  22,9m\"" . qscheckselected("877773A75 75 ft  22,9m",$itemvalue,"selected") . ">877773A75 75 ft  22,9m</option></select>";
    if ($cellvalue == "") {
        $cellvalue = " ";
    }
    print "<td class=" . $css_class . " align=Default >" . $cellvalue . "</td>";
?>

 

 

Please help me with this issue.

 

Br,

Tl

Link to comment
https://forums.phpfreaks.com/topic/46762-php-dropdown-box-problem/
Share on other sites

Now, if you choose any model from the dropdown menu, you can choose any cable (Kaapeli) from the cable dropdown menu.

 

If i choose model 1 from dropdown menu i get to choose from dropdown menu 2 another item. But if i choose model 2 from dropdown menu, dropdown menu nro: 2 should be disabled.

 

<td class="ThRows style2">Malli</td>
<?php
$cellvalue = "";
if ((!isset($_GET["add_fd3"])) && (!isset($_POST["add_fd3"]))) {
    $itemvalue = "";
} else {
    $itemvalue = qsrequest("add_fd3");
}
$cellvalue = "<select name=\"§\" ><option value=\"\"" . qscheckselected("",$itemvalue,"selected") . ">-- Valitse --</option><option value=\"1F15203 FB F15M\"" . qscheckselected("1F15203 FB F15M",$itemvalue,"selected") . ">1F15203 FB F15M</option><option value=\"1F15213 FB F15ML\"" . qscheckselected("1F15213 FB F15ML",$itemvalue,"selected") . ">1F15213 FB F15ML</option><option value=\"1F15302 FB F15E\"" . qscheckselected("1F15302 FB F15E",$itemvalue,"selected") . ">1F15302 FB F15E</option><option value=\"1F15312 FB F15EL\"" . qscheckselected("1F15312 FB F15EL",$itemvalue,"selected") . ">1F15312 FB F15EL

<td class="ThRows style2">Kaapeli</td>
<?php
$cellvalue = "";
if ((!isset($_GET["add_fd5"])) && (!isset($_POST["add_fd5"]))) {
    $itemvalue = "";
} else {
    $itemvalue = qsrequest("add_fd5");
}

    $cellvalue = "<select name=\"add_fd5\" ><option value=\"\"" . qscheckselected("",$itemvalue,"selected") . ">-- Valitse --</option><option value=\"877773A3 3 ft  0,92m\"" . qscheckselected("877773A3 3 ft  0,92m",$itemvalue,"selected") . ">877773A3 3 ft  0,92m</option><option value=\"877773A4 4 ft  1,2m\"" . qscheckselected("877773A4 4 ft  1,2m",$itemvalue,"selected") . ">

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.