Hi All,
I am trying create 4 dropdowns and load the values based on the value selected in the previous dropdown. I am able to do this for 3 dropdowns, but for the fourth dropdown I am no able to populate the value.
Could someone help me out with this please?
---------------------------------------
ajaxData_1.php
<?php
// Include the database config file
include_once 'dbconfig_1.php';
if(!empty($_POST["solutions_id"])){
// Fetch state data based on the specific country
$query = "SELECT * FROM releases WHERE solutions_id = ".$_POST['solutions_id'];
$result = $db->query($query);
if($result->num_rows > 0){
echo '<option value="">Select release</option>';
while($row = $result->fetch_assoc()){
echo '<option value="'.$row['releases_id'].'">'.$row['releases_name'].'</option>';
}
}
else{
echo '<option value="">Release not available</option>';
}
}
elseif(!empty($_POST["releases_id"])){
$query = "SELECT * FROM versions WHERE releases_id = ".$_POST['releases_id']."";
$result = $db->query($query);
if($result->num_rows > 0){
echo '<option value="">Select version</option>';
while($row = $result->fetch_assoc()){
echo '<option value="'.$row['version_id'].'">'.$row['supported_version'].'</option>';
}
}
else{
echo '<option value="">Version not available</option>';
}
}
elseif(!empty($_POST["versions_id"]))
{
$query = "SELECT * FROM platforms WHERE version_id = ".$_POST['version_id']."";
$result = $db->query($query);
if($result->num_rows > 0){
echo '<option value="">Select Version</option>';
while($row = $result->fetch_assoc()){
echo '<option value="'.$row['platforms_id'].'">'.$row['platforms_name'].'</option>';
}
}
else{
echo '<option value="">Platform not available</option>';
}
}
?>
<?php
if(isset($_POST['submit']))
{
echo 'Selected Solution ID: '.$_POST['solution'];
echo 'Selected Release ID: '.$_POST['release'];
echo 'Selected Version ID: '.$_POST['version'];
echo 'Selected Platform ID: '.$_POST['platform'];
}
?>
Index_3.php
<!DOCTYPE html>
<html>
<head>
<title style="color: 000000">Solution Compatibility Matrix</title>
<style>
select
{
padding: 12px;
min-width:280px;
margin-top:10px;
}
.san{
width:280px;
margin:0 auto;
margin-top:90px;
background-color:#FFFFFF;
padding:55px;
color: 000000;
}
label
{
color:#000000;
margin-bottom:25px;
}
html{
background-color: #3399CC;
}
</style>
</head>
<body>
</body>
</html>
Thanks,
Arun