Newsgroup: it.comp.www.php
Titolo: Select combinate non riesco a fal la query

        <script type="text/javascript" src="js/jquery-1.4.2.js"></script>
        <script type="text/javascript">
            $(document).ready(function() {
                $('#loader').hide();
                $('#make').change(function(){
                    $('#model').fadeOut();
                    $('#loader').show();
                    $.post("ajax/ajax_model.php", {
                        make: $('#make').val()
                    }, function(response){
                        setTimeout("finishAjax('model', 
'"+escape(response)+"')", 400);
                    });
                    return false;
                });
                ///////////////////////////////////////////
                $('#make_1').change(function(){
                    $('#model_1').fadeOut();
                    $('#loader').show();
                    $.post("ajax/ajax_model.php", {
                        make: $('#make_1').val()
                    }, function(response){
                        setTimeout("finishAjax('model_1', 
'"+escape(response)+"')", 400);
                    });
                    return false;
                });
                ///////////////////////////////////////////
                $('#make_2').change(function(){
                    $('#model_2').fadeOut();
                    $('#loader').show();
                    $.post("ajax/ajax_model.php", {
                        make: $('#make_2').val()
                    }, function(response){
                        setTimeout("finishAjax('model_2', 
'"+escape(response)+"')", 400);
                    });
                    return false;
                });
                ///////////////////////////////////////////
                $('#make_3').change(function(){
                    $('#model_3').fadeOut();
                    $('#loader').show();
                    $.post("ajax/ajax_model.php", {
                        make: $('#make_3').val()
                    }, function(response){
                        setTimeout("finishAjax('model_3', 
'"+escape(response)+"')", 400);
                    });
                    return false;
                });
                ///////////////////////////////////////////
                $('#make_4').change(function(){
                    $('#model_4').fadeOut();
                    $('#loader').show();
                    $.post("ajax/ajax_model.php", {
                        make: $('#make_4').val()
                    }, function(response){
                        setTimeout("finishAjax('model_4', 
'"+escape(response)+"')", 400);
                    });
                    return false;
                });
                ///////////////////////////////////////////
                $('#make_5').change(function(){
                    $('#model_5').fadeOut();
                    $('#loader').show();
                    $.post("ajax/ajax_model.php", {
                        make: $('#make_5').val()
                    }, function(response){
                        setTimeout("finishAjax('model_52', 
'"+escape(response)+"')", 400);
                    });
                    return false;
                });
                ///////////////////////////////////////////
                $('#make_6').change(function(){
                    $('#model_6').fadeOut();
                    $('#loader').show();
                    $.post("ajax/ajax_model.php", {
                        make: $('#make_6').val()
                    }, function(response){
                        setTimeout("finishAjax('model_6', 
'"+escape(response)+"')", 400);
                    });
                    return false;
                });
                ///////////////////////////////////////////
            });
            function finishAjax(id, response){
                $('#loader').hide();
                $('#'+id).html(unescape(response));
                $('#'+id).fadeIn();
            }
        </script>
    </head>
    <body>
        <div id="loader"><strong>Loading...</strong></div>
        <form name="theform" id="form" method="POST" action="search.php">
            <?php
            include('lib/class_dbcon.php');
            $connect = new doConnect();
            ?>
            <?php
            $i = 1;
            while ($i <= 6) {
                ?>
                <label for="make">Articolo:</label>
                <select id="make_<?php echo $i; ?>" name="make_<?php echo 
$i; ?>">
                    <?php
                    $option .= '<option value="">-- Select 
Prodotto --</option>';
                    $query = mysql_query("SELECT * FROM product ORDER BY 
ProductName ASC") or die(mysql_error());
                    while ($row = mysql_fetch_assoc($query)) {
                        echo '<option value="' . $row['ProductID'] . '"';
                        echo '>' . $row['ProductName'] . ' - ' . 
$row['ProductColor'] . ' - ' . $row['ProductSku'] . '</option>' . "\n";
                    }
                    echo $option;
                    ?>
                </select>
                <label for="model_<?php echo $i; ?>">Tipo Stampa:</label>
                <select id="model_<?php echo $i; ?>" name="model_<?php echo 
$i; ?>">
                    <option value="">-- Select Model --</option>
                </select>
                <br />
                <?php
                $i++;
            }
            ?>
            <input type="submit" name="submit" value="Search">
        </form>
////////////////////////////////
il secondo file chiamato ajax_model.php  mi crea la query
  $i = 1;
    while ($i <= 6) {
    if (isset($_POST['make_' . $i])) {
        if (!$_POST['make_' . $i] == "") {
            $make = $_POST['make_' . $i];
            $option .= '<option value="">-- Select Model --</option>';
            $query = mysql_query("
    SELECT printtype.PrinttypeID , printtype.Printtype, 
print_product.PrinttypeID, print_product.ProductID
    FROM printtype
    LEFT JOIN print_product
    ON printtype.PrinttypeID = print_product.PrinttypeID
    WHERE print_product.ProductID = '".$_POST['make_' . $i]."'
    ORDER BY Printtype ASC
    ") or die(mysql_error());
            while ($row = mysql_fetch_assoc($query)) {
                echo '<option value="' . $row['PrinttypeID'] . '"';
                echo '>' . $row['Printtype'] . '</option>' . "\n";
            }
            echo $option;
        }
    }
 $i++;
    }
/////////////////////////////////
Nelle righe postate sopra sono 2 file
con la prima select faccio una semplice query per trovare il valore nella 
seconda select
non riesco a far fare la query riga per riga
ho postato tutto proprio per capire dove sta l'errore
Dove cavolo sbaglio?

 ha scritto nel messaggio 
news:4e905f8a$0$43511$4faf...@reader2.news.tin.it...

Trovata soluzione...
la riga make: $('#make_6').val()
dovevo cambiarla in make_6: $('#make_6').val()