w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Multiple selection boxes to search a database

I am not sure why you have html included in your ajax processing file. Usually you keep a .php file consisting only of php code and then you can be sure no html or script code are being included (which is currently happening in your page now).

For one, try to change your model dropdown code to:

    <?php
            //loads the models based on the makes selection into a
dependant dropdown
            if (isset($_REQUEST['ajaxmake'])) {

                echo "<select name='modelSelection'>"; //select tag
placed here
                $resultModel = odbc_exec($conn, "SELECT Model FROM Vehicle
WHERE Make = '".$_REQUEST['ajaxmake']."'") or die (odbc_errormsg());

                    while ($rowModel = odbc_fetch_array($resultModel)) {

                        echo "<option
value='$rowModel[Model]'>$rowModel[Model]</option>";
                    }

                    echo "</select><br>";
                    die(); //<-- the die placed here will not execute
the rest of
                           //the code and also all the options will be
populated

            }
    ?>




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.