0

Hi everyone i need help in getting value from 3 depenedable dropdown menu and after selecting option from 3 dropdown menu the data showed be shown in textbox eg.
First value package1
Second Value car1
Third value Type

and textbox value Rate1 Rate2 Rate3

Please help me in this
Thanks in advance
Praveen

2
Contributors
2
Replies
18
Views
1 Year
Discussion Span
Last Post by Praveen_15
0

Hi,
A lot of people are willing to help, but you have to show how you are going about this. Where are you having issues and the output you are getting. Yes, you have shown what you wanted but how should it be solved? One can't just assumed.

0
<?php
include_once 'dbconfig.php';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Dynamic Dependent Select Box using jQuery and PHP</title>
<script type="text/javascript" src="jquery-1.4.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
    $(".car").change(function()
    {
        var id=$(this).val();
        var dataString = 'id='+ id;

        $.ajax
        ({
            type: "POST",
            url: "get_pack.php",
            data: dataString,
            cache: false,
            success: function(html)
            {
                $(".pack").html(html);
            } 
        });
    });


    $(".pack").change(function()
    {
        var id=$(this).val();
        var dataString = 'id='+ id;

        $.ajax
        ({
            type: "POST",
            url: "get_type.php",
            data: dataString,
            cache: false,
            success: function(html)
            {
                $(".type").html(html);
            } 
        });
    });

});
</script>
<style>
label
{
font-weight:bold;
padding:10px;
}
div
{
    margin-top:100px;
}
select
{
    width:200px;
    height:35px;
}
</style>
</head>

<body>
<center>
<div>
<label>Car :</label> 
<select name="car" class="car">
<option selected="selected">--Select Car--</option>
<?php
    $stmt = $DB_con->prepare("SELECT * FROM tbl_car");
    $stmt->execute();
    while($row=$stmt->fetch(PDO::FETCH_ASSOC))
    {
        ?>
        <option value="<?php echo $row['car_id']; ?>"><?php echo $row['car_name']; ?></option>
        <?php
    } 
?>
</select>

<label>pack :</label> <select name="pack" class="pack">
<option selected="selected">--Select pack--</option>
</select>


<label>type :</label> <select name="type" class="type">
<option selected="selected">--Select type--</option>
</select>

</div>
<br />
<a href="http://www.codingcage.com/2015/04/dynamic-dependent-select-box-using-jquery-php.html">tutorial link</a>
</center>
</body>
</html>
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.