Hello All,
I have a function wherein I am calling all the dropdown values as follows:
//get all options in a drop down
public function getDDOptions($ddId, $activeOnly = 0, $orderBy = ''){
include 'connect_db.php';
$records = array();
$where = ($activeOnly) ? ' AND is_active = 1 ' : '';
$orderBy = ($orderBy) ? $orderBy : ' FIELD(option_value, "other"),option_value asc ';
$result = mysqli_query($connect,"SELECT option_key, option_value FROM dropdown_options WHERE dropdown_id = " . $ddId . $where . " ORDER BY ".$orderBy);
if ($result) {
// collect all rows in an array
while($row = mysqli_fetch_array($result, MYSQLI_ASSOC)){
$records[$row['option_key']] = $row['option_value'];
}
}
return $records;
}
Then in my another php file I am calling this as:
$travel_mode = $ddObj->getDDOptions(DropDownIds::TRAVELMODE, 1, 'Id ASC');
Now so far it was only the selection of dropdown values. But I now want to show/create textbox on selection of one of the dropdown value from the DB.
<div align="center">
<select name="travel_det[t_mode][]" style="width:60px;" class="jsTravelCls" id="hlttravelmode">
<?php foreach ($travel_mode as $tra_mode) {
echo "<option value=\"" . $tra_mode . "\">" . $tra_mode . "</option>";
}
?>
</select>
</div>
Any help would be great.