1

I have a jQuery drop down list that uses first CARS then secondly, the models from that car. Then, when the second choice is made - hit a submit button and search for the tire that the car uses. It works great the first time, but the second time, it stops and I have to reload the page to get it to work again. Any ideas of why this is happening would be helpful. My code example is here:

Accessing a variable from inside a jquery drop down list?

Here is the code that searches:

function findtire() {
    global $db;
    if (isset($_POST['car'])) {
        $_SESSION['car'] = $_POST['car'];
        $car = $_SESSION['car'];
    }

    if (isset($car)) {
        $query = $db->prepare("SELECT idtires FROM vehicle WHERE idcarmodel = '$car'");
        $query->execute();
        $tire = $query->fetchAll();
    }

    if (isset($tire)) {
        echo "<ul>";
        foreach ($tire as $name) {
            echo "<li id='tiresearch'>";
            echo "Tire Size is Available: " . $name['idtires'];
            echo "</li>";
        }
        echo "</ul>";
    }
    else {
    }
}
Community
  • 1
  • 1

0 Answers0